Irregular AD login prompts for SharePoint 2013 after subsequent AJAX calls in Edge

Eddy Z | Windex 1 Reputation point
2022-02-16T10:36:48.367+00:00

Hello,

Since some time ago some customers complain that they get login prompts while using our webparts on a SharePoint 2013 web part page. The web application has been configured to use Windows Authentication (on-premise Active Directory).

Our web part consists of an UpdatePanel and a number of Buttons with (server) click events, and a gridview with a SelectedIndexChanged event.
The problem happens when __doPostBack is called within the UpdatePanel, but not always.

Sometimes it happens after some time of user inactivity (for instance after 3 minutes), however the problem doesn't occur systematically.

If we get a login prompt while monitoring the Developer Tools Network tab, we see that no network traffic took place nor any console error appeared before the call that initiated the login prompt.
When a login prompt appears, and you don't enter the correct credentials or click Cancel, the following message appears in the Dev Toolbar console:

174839-image.png

After an unsuccesful or canceled login attempt, in the Network tab HTTP Status code 401 (Unauthorized) is returned for default.aspx, with Initiator ScriptResource.axd?xxxx:

174953-image.png

We've checked the request headers of a succesful call versus an unsuccesful one, but the information we get is mostly the same:

174933-image.png

Does anybody have an idea what might be going wrong? What are we missing?
Any help on this would be greatly appreciated.

Many thanks,

Eddy and Robbert
Windex

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,413 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,901 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,609 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Eddy Z | Windex 1 Reputation point
    2022-02-22T07:31:08.333+00:00

    Hello,

    Thanks for your reply.
    Sorry for not coming back to you sooner.

    I'm currently having trouble adding code samples to this, I'll make some screenshots instead.

    Thanks, Eddy

    0 comments No comments

  2. Eddy Z | Windex 1 Reputation point
    2022-02-22T08:52:16.583+00:00

    Hi,

    Our webpart is implemented as a custom control (ASP.NET Server Control).
    Its child controls are added during the serverside control lifecycle in a CreateControlHierarchy method.

    We further use client scripting to handle some things client-side, like:

    • preventing postbacks before the last postback has been completed
    • doing the actual postback using __doPostBack (SelectedIndexChanged en Paging Events)

    Below is the implementation of the following client-side event handlers:

    • Click event of table row
    • Click event of pager buttons
        // Client-side Click event of GridView Table Row  
      
        function BusinessObjectView_RowClk(sender, target, args, ev, id, single, deselectEnabled) {  
            var vars = BusinessObjectView_GetGlobalVars(id);  
            var e = ev ? ev : event, obj = e.target || e.srcElement;  
            var checkBox = BusinessObjectView_GetCheckBox(obj);  
      
            if (single || obj.className != businessObjectView_checkBoxClass) {  
      
                // If same row selected -> Deselect this  
                if (deselectEnabled && vars.selectedId == checkBox.value) {   
                    var selectedId = $get(id + "_selectedId");  
                    selectedId.value = "";  
      
                    // Set SelectedIndex to -1  
                    args = "Select$-1";   
      
                    sender.className = "wccGridViewRow";  
                    checkBox.checked = false;  
                    vars.selectedId = null;  
                }  
                else  
                    // Use BusinessObject ID for unique row identification  
                    vars.selectedId = checkBox.value;   
      
                // Don't fire SelectedIndexChanged after click on action button  
                if (obj.parentNode.className != "wcc_ActionPanel") {  
      
                    // Prevent ParameterCountException on double click  
                    if (businessObjectView_loading == null || businessObjectView_loading.style.display == "none")   
      
                        // Trigger SelectedIndexChanged event of GridView  
                        __doPostBack(target, args);  
      
                    BusinessObjectView_AnimateRow(sender, id);  
                }  
            }  
            businessObjectView_ClickHandled = true;  
        }  
      
        // Client-side Page event of GridView  
      
        function BusinessObjectView_Page(obj, uniqueId) {  
            if (!obj.disabled) { // Prevent multiple postbacks (in case the user clicks again before the last postback was completed)  
                AnimateElement(obj.id, '');  
      
                // Trigger Page event of GridView  
                __doPostBack(uniqueId, 'Page$' + (obj.value - 1));   
      
                obj.disabled = true;  
            }  
        }  
      

    This code has been in use for the last 15 years or so without any (major) problems.
    However, sometime last year our customers started expierencing these random Active Directory logon prompts while using the web part page.
    They seem to happen during these __doPostBack calls.

    When this happens, after you re-enter your correct credentials the postback and subsequent postbacks are completed succesfully.
    When you cancel the logon prompt a generic PageRequestManagerServerError is thrown.
    Unfortanately we haven't been able to find what exactly leads to that error.

    Any ideas on what might be going wrong?

    Thanks,

    Eddy

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.