locked
Long running AJAX call graceful abort/error handling RRS feed

  • Question

  • User-159225446 posted

    I've been reading a lot of posts and cannot find anything that addresses the issue of long AJAX calls and aborting/handling them.

    I'm familar with the timeout values, etc. But I have two issues, here is my object line for the script manager (and I'm using 4.5 web forms so I know it can be just ScriptManager, and maybe tookitmanager is causing issues)

    <asp:ToolkitScriptManager ID="SMMasterPage5" ScriptMode="Release" OnAsyncPostBackError="SMMasterPage5_AsyncPostBackError" AsyncPostBackTimeout="600" runat="server" />

    The '_AsyncPostBackError' handler isn't working? It never goes into that block. Unless I'm not understanding what is occuring. I've tried to force it by setting to AsyncPostBackTimeout="10" and I just get an AJAX error dialog (but I'm in debug and on my dev machine (maybe this works in release and on server?)).

    And the second issue what if I want to stop the call, so that my "Please wait..." doesn't get locked up and spins forever. I would like to gracefully stop the call after x miniutes and return to UI. I have the update panel on a masterpage wrapping the content page.

    I'm not using async/await. Straight sync call.

    I've searched the web and everything I've found is regarding the timeout setting.

    Thanx.

    Thursday, December 19, 2013 9:08 AM

Answers

  • User1734617369 posted

    Hi,

    Here is the master page:

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="das5.master.cs" Inherits="WebApplication2.das5" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="headMasterPage5" runat="server">
        <meta http-equiv="cache-control" content="max-age=0" />
        <meta http-equiv="cache-control" content="no-cache" />
        <meta http-equiv="expires" content="0" />
        <meta http-equiv="expires" content="Tue, 01 Jan 1990 12:00:00 GMT" />
        <asp:PlaceHolder ID="phfavicon" runat="server">
            <link rel="shortcut icon" type="image/x-icon" href="<%= Page.ResolveUrl(String.Format("~/App_Themes/{0}/Images/favicon.ico", Page.Theme)) %>" />
        </asp:PlaceHolder>
        <title></title>
        <asp:ContentPlaceHolder ID="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body id="masterBody5" runat="server">
        <form id="dasMaster5" runat="server">
            <asp:ScriptManager ID="SMMasterPage5" ScriptMode="Release" runat="server" AsyncPostBackTimeout="10" />
            <div>
                <asp:Panel ID="pnlHeader" runat="server">
                    <!-- Top Header Image Area -->
                    <table cellpadding="0" cellspacing="0" style="width: 100%; margin: 0px; padding: 0px; border: none;">
                        <tr>
                            <td class="dasheaderleftside"></td>
                            <td class="dasheaderslice"></td>
                            <td class="dasheaderrightside">
                                <asp:UpdatePanel ID="upLangSelection" runat="server">
                                    <ContentTemplate>
                                        <table style="width: 100%;">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblLanguageSelection" CssClass="whitelabels" runat="server" />
                                                    <br />
                                                    <asp:DropDownList ID="ddLanguageSelection" CausesValidation="false" AutoPostBack="true"
                                                        runat="server">
                                                        <asp:ListItem Value="en-US" Text="English" />
                                                        <asp:ListItem Value="es" Text="Spanish" />
                                                        <asp:ListItem Value="fr-CA" Text="French Canadian" />
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                        </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <!-- Debug Area -->
                <div id="divDebug" runat="server">
                    <table style="width: 100%;">
                        <tr>
                            <td class="debug">
                                <asp:Label ID="lblDebugTitle" EnableTheming="false" runat="server"
                                    Text="Debug Information: On" />
                                <br />
                                <asp:Label ID="lblSessionID" EnableTheming="false" runat="server" />
                                <br />
                                <asp:Label ID="lblConn" EnableTheming="false" runat="server" />
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- nav menu -->
                <div id="divMainMenu" runat="server">
                    <table cellpadding="0" cellspacing="0" class="mainmenu">
                        <tr>
                            <td id="tdMainMenu" style="text-align: left; vertical-align: middle;" runat="server">
                                <asp:UpdatePanel ID="upDASMenu5" runat="server">
                                    <ContentTemplate>
                                        
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                            <td id="tdLinkButtons" style="text-align: right; vertical-align: middle;" class="whitelabels" runat="server">
                                <asp:UpdatePanel ID="upLinkNavBar" runat="server">
                                    <ContentTemplate>
                                        <asp:Label ID="lblDealer" runat="server" />
                                        <asp:Label ID="lblDASDate" runat="server" />
                                        <asp:LinkButton ID="lnkbtnHome" CausesValidation="false" runat="server" OnClick="lnkbtnHome_Click" />
                                        <asp:LinkButton ID="lnkbtnLogOut" CausesValidation="false" runat="server" OnClick="lnkbtnLogOut_Click" />
                                        <asp:LinkButton ID="lnkbtnHelp" CausesValidation="false" runat="server" OnClick="lnkbtnHelp_Click" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </div>
                <table style="width: 100%; text-align: left;">
                    <tr>
                        <td style="width: 100%; text-align: left;">
                            <!-- mega dealers list -->
                            <div id="divMegaDlrselect" runat="server">
                                <table style="width: 100%; text-align: left;">
                                    <tr>
                                        <td>
                                            <asp:UpdatePanel ID="upcMegaDealerList" runat="server">
                                                <ContentTemplate>
                                                    <asp:Label ID="lblSelectDealer" runat="server" />
                                                    
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
                <!-- core body including menu -->
                <table style="width: 100%;">
                    <tr>
                        <td style="vertical-align: top;">
                            <!-- System Messages -->
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        <asp:UpdatePanel ID="upSystemMessages" runat="server">
                                            <ContentTemplate>
                                                <asp:PlaceHolder ID="phSystemMessages" runat="server" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </td>
                                </tr>
                            </table>
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        <div class="center">
                                            <table style="width: 100%;">
                                                <tr>
                                                    <!-- Body Content -->
                                                    <td>
                                                        <asp:UpdatePanel ID="upMainContentBody5" runat="server">
                                                            <ContentTemplate>
                                                                <div id="divBody" class="bodycell">
                                                                    <asp:ContentPlaceHolder ID="contentBody" runat="server" />
                                                                </div>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upMainContentBody5"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitContentBody" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingContentBody" runat="server" Text="" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress2" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upcMegaDealerList"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitMegaDealerList" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingMegaDealerList" runat="server" Text="" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress3" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upDASMenu5"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitMenuBar" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingtMenuBar" runat="server" Text="" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress4" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upLinkNavBar"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaituplinknavbar" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessinguplinknavbar" runat="server" Text="" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <asp:Panel ID="pnlFooter" runat="server">
                    <asp:UpdatePanel ID="upFooter" runat="server">
                        <ContentTemplate>
                            <!-- footer -->
                            <table class="footer">
                                <tr>
                                    <td>
                                        <asp:Label ID="lblDisclaimer1" runat="server" />
                                        <br />
                                        
                                        <br />
                                        <asp:Label ID="lblCopyRight" CssClass="footer" runat="server" />
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </asp:Panel>
                <script type="text/javascript">
                    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
                    function EndRequest(sender, args) {
                        if (args.get_error() != undefined) {
                            var err = args.get_error();
                            if (err.name == 'Sys.WebForms.PageRequestManagerTimeoutException') {
                                alert('The current request has exceeded the alloted time, please limit your search criteria, or contact your system administrator. Thank you.');
                                args.set_errorHandled(true);
    
                                var prm = Sys.WebForms.PageRequestManager.getInstance();
                                prm.abortPostBack();
                                //location.reload(true);
    
                            }
                        }
                    }
                </script>
            </div>
        </form>
    </body>
    </html>

    and the code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebApplication2
    {
        public partial class das5 : System.Web.UI.MasterPage
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
            protected void lnkbtnHome_Click(object sender, EventArgs e)
            {
    
            }
    
            protected void lnkbtnLogOut_Click(object sender, EventArgs e)
            {
    
            }
    
            protected void lnkbtnHelp_Click(object sender, EventArgs e)
            {
    
            }
        }
    }

    and the content page:

    <%@ Page Title="" Language="C#" MasterPageFile="~/das5.Master" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication2.WebForm2" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="contentBody" runat="server">
        <asp:Button Text="Yes?" ID="Btn1" OnClick="Btn1_Click" runat="server" />
        <asp:Label Text="" ID="Lbl1" runat="server" />
    </asp:Content>
    

    and the code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebApplication2
    {
        public partial class WebForm2 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
            protected void Btn1_Click(object sender, EventArgs e)
            {
                Thread.Sleep(30000);
                Lbl1.Text = "Oki";
            }
        }
    }

    This works for me without any problem.

    /Johan

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 20, 2013 4:14 PM
  • User-159225446 posted

    Ok, After moving the web app to a QA server, it works fine. It appears to have issues working from my development enviroment (VS 2012) workstation, Win 7 IIS 7. 

    So, if anyone else has an issue, that might be the cause.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 30, 2013 9:42 AM

All replies

  • User1734617369 posted

    Hi,

    The OnAsyncPostBackError is not being triggered by the error that is caused by the AsyncPostBackTimeout, that is only happening on the client side. If you would like to handle the timeout you can do something like in this example:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="5" AllowCustomErrorsRedirect="false" OnAsyncPostBackError="ToolkitScriptManager1_AsyncPostBackError"></asp:ScriptManager>
            <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                <ProgressTemplate>
                    Please wait...
                </ProgressTemplate>
            </asp:UpdateProgress>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:Button Text="Ok.." OnClick="Unnamed_Click" runat="server" /><br />
                    <asp:Label Text="" ID="Label1" runat="server" />
                </ContentTemplate>
            </asp:UpdatePanel>
            <script>
                Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
                function EndRequest(sender, args)  
                { 
                        if (args.get_error() != undefined)  
                        {
                            var err = args.get_error();
                            if (err.name == 'Sys.WebForms.PageRequestManagerTimeoutException')
                            {
                                alert(err.message);
                                args.set_errorHandled(true);
                                var prm = Sys.WebForms.PageRequestManager.getInstance();
                                prm.abortPostBack();
                            }                        
                        }
                }
            </script>
        </form>
    </body>
    </html>

    Best regards
    Johan

    Thursday, December 19, 2013 1:34 PM
  • User-159225446 posted

    This is great! Thanx, it is exactly what I was looking for. 

    Thursday, December 19, 2013 2:35 PM
  • User-159225446 posted

    I spoke too soon. It brings me back to the UI, allowing control. But if I try to use any of the menu options or links, etc it freezes as "waiting for localhost.." Like it's re0running the "please wait.." call and then it prompts me that it timedout and remains on the same page that I have been on???

    Thursday, December 19, 2013 3:03 PM
  • User-933407369 posted

    hi chris555,

    Thanks for your reply.

    Based on your description, i would suggest you refer to the link below:

    Handling timeouts gracefully in AJAX using client-side code

    http://geekswithblogs.net/lorint/archive/2006/03/07/71625.aspx

    Hope it helps you.

    Friday, December 20, 2013 3:23 AM
  • User-159225446 posted

    Great replies, it's really helped me search for more information.

    But I would like to better understand why your suggestion isn't working for me. Did it work for you?

    It returns me to the UI. If I try anything on the page, including the original button submit there isn't a postback? It never goes in Page_Load????

    Regardless of what I try it loads my updatepanel "Please Wait" and loops forever never postbacking.

    This would be great if it work after it returned. 

    I've tried using some other suggestions and methods but no luck.......

    Ideas, Please :)

    I've tried reloading the page with JavaScript, I've tried redirecting to another page with Javascript. The site is dead. After initiating: 

    prm.abortPostBack();

    Friday, December 20, 2013 11:00 AM
  • User-159225446 posted

    If it helps. This is a web form app using masterpage and content pages. The UpdatePanel is on the masterpage, wrapping the content.

    My UpdateProgress works great.

    I've even tried adding a linkbutton to allow cancelling and I get the same "locked" condition. I've read on other postings similar issues but they said refreshing the page clear this issue. It doesn't work for me. I really wish I understood why why the Ajax call is aborted and it returns to the UI that the app is trashed. I can't even browser refresh the page it hangs.

    Help.....

    Friday, December 20, 2013 12:08 PM
  • User1734617369 posted

    Hi,

    It is hard to pinpoint the problem without seing your code since the code example I wrote works, does that work for you? Can you provide any code so that we may see if the problem can be found?

    /Johan

    Friday, December 20, 2013 12:42 PM
  • User-159225446 posted

    Here's the master page that has the updatepanel's, etc. The content pages just have content. I thought about moving your script ide a to registerclient script at startup in code-behind (but that shouldn't be the issue). The maincontent panel is (this where the content is getting recycled (i.e. search and db calls):

    upMainContentBody5
    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="das5.master.cs" Inherits="DASNET5.das5" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    
    <%@ Register Src="~/Controls/wcMegaDealerList.ascx" TagPrefix="ucDSTControls" TagName="wcMegaDealerList" %>
    <%@ Register Src="~/Controls/ViewSwitcher.ascx" TagPrefix="ucDSTControls" TagName="ViewSwitcher" %>
    <%@ Register Src="~/Controls/wcMenu5x.ascx" TagPrefix="ucDSTControls" TagName="wcMenu5x" %>
    
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="headMasterPage5" runat="server">
        <meta http-equiv="cache-control" content="max-age=0" />
        <meta http-equiv="cache-control" content="no-cache" />
        <meta http-equiv="expires" content="0" />
        <meta http-equiv="expires" content="Tue, 01 Jan 1990 12:00:00 GMT" />
        <asp:PlaceHolder ID="phfavicon" runat="server">
            <link rel="shortcut icon" type="image/x-icon" href="<%= Page.ResolveUrl(String.Format("~/App_Themes/{0}/Images/favicon.ico", Page.Theme)) %>" />
        </asp:PlaceHolder>
        <title></title>
        <asp:ContentPlaceHolder ID="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body id="masterBody5" runat="server">
        <form id="dasMaster5" runat="server">
            <asp:ScriptManager ID="SMMasterPage5" ScriptMode="Release" runat="server" />
            <div>
                <asp:Panel ID="pnlHeader" runat="server">
                    <!-- Top Header Image Area -->
                    <table cellpadding="0" cellspacing="0" style="width: 100%; margin: 0px; padding: 0px; border: none;">
                        <tr>
                            <td class="dasheaderleftside"></td>
                            <td class="dasheaderslice"></td>
                            <td class="dasheaderrightside">
                                <asp:UpdatePanel ID="upLangSelection" runat="server">
                                    <ContentTemplate>
                                        <table style="width: 100%;">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblLanguageSelection" CssClass="whitelabels" runat="server" />
                                                    <br />
                                                    <asp:DropDownList ID="ddLanguageSelection" CausesValidation="false" AutoPostBack="true"
                                                        runat="server">
                                                        <asp:ListItem Value="en-US" Text="English" />
                                                        <asp:ListItem Value="es" Text="Spanish" />
                                                        <asp:ListItem Value="fr-CA" Text="French Canadian" />
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                        </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <!-- Debug Area -->
                <div id="divDebug" runat="server">
                    <table style="width: 100%;">
                        <tr>
                            <td class="debug">
                                <asp:Label ID="lblDebugTitle" EnableTheming="false" runat="server"
                                    Text="Debug Information: On" />
                                <br />
                                <asp:Label ID="lblSessionID" EnableTheming="false" runat="server" />
                                <br />
                                <asp:Label ID="lblConn" EnableTheming="false" runat="server" />
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- nav menu -->
                <div id="divMainMenu" runat="server">
                    <table cellpadding="0" cellspacing="0" class="mainmenu">
                        <tr>
                            <td id="tdMainMenu" style="text-align: left; vertical-align: middle;" runat="server">
                                <asp:UpdatePanel ID="upDASMenu5" runat="server">
                                    <ContentTemplate>
                                        <ucDSTControls:wcMenu5x runat="server" id="wcMenu5x" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                            <td id="tdLinkButtons" style="text-align: right; vertical-align: middle;" class="whitelabels" runat="server">
                                <asp:UpdatePanel ID="upLinkNavBar" runat="server">
                                    <ContentTemplate>
                                        <asp:Label ID="lblDealer" runat="server" />
                                        <asp:Label ID="lblDASDate" runat="server" />
                                        <asp:LinkButton ID="lnkbtnHome" CausesValidation="false" runat="server" OnClick="lnkbtnHome_Click" />
                                        <asp:LinkButton ID="lnkbtnLogOut" CausesValidation="false" runat="server" OnClick="lnkbtnLogOut_Click" />
                                        <asp:LinkButton ID="lnkbtnHelp" CausesValidation="false" runat="server" OnClick="lnkbtnHelp_Click" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </div>
                <table style="width: 100%; text-align: left;">
                    <tr>
                        <td style="width: 100%; text-align: left;">
                            <!-- mega dealers list -->
                            <div id="divMegaDlrselect" runat="server">
                                <table style="width: 100%; text-align: left;">
                                    <tr>
                                        <td>
                                            <asp:UpdatePanel ID="upcMegaDealerList" runat="server">
                                                <ContentTemplate>
                                                    <asp:Label ID="lblSelectDealer" runat="server" />
                                                    <ucDSTControls:wcMegaDealerList runat="server" ID="wcMegaDealerList" DontChangeDealer="false" RefreshUsersList="false" />
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
                <!-- core body including menu -->
                <table style="width: 100%;">
                    <tr>
                        <td style="vertical-align: top;">
                            <!-- System Messages -->
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        <asp:UpdatePanel ID="upSystemMessages" runat="server">
                                            <ContentTemplate>
                                                <asp:PlaceHolder ID="phSystemMessages" runat="server" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </td>
                                </tr>
                            </table>
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        <div class="center">
                                            <table style="width: 100%;">
                                                <tr>
                                                    <!-- Body Content -->
                                                    <td>
                                                        <asp:UpdatePanel ID="upMainContentBody5" runat="server">
                                                            <ContentTemplate>
                                                                <div id="divBody" class="bodycell">
                                                                    <asp:ContentPlaceHolder ID="contentBody" runat="server" />
                                                                </div>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upMainContentBody5"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitContentBody" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingContentBody" runat="server" Text="<%$ Resources:dasnet,1132 %>" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress2" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upcMegaDealerList"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitMegaDealerList" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingMegaDealerList" runat="server" Text="<%$ Resources:dasnet,1132 %>" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress3" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upDASMenu5"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitMenuBar" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingtMenuBar" runat="server" Text="<%$ Resources:dasnet,1132 %>" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress4" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upLinkNavBar"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaituplinknavbar" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessinguplinknavbar" runat="server" Text="<%$ Resources:dasnet,1132 %>" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <asp:Panel ID="pnlFooter" runat="server">
                    <asp:UpdatePanel ID="upFooter" runat="server">
                        <ContentTemplate>
                            <!-- footer -->
                            <table class="footer">
                                <tr>
                                    <td>
                                        <asp:Label ID="lblDisclaimer1" runat="server" />
                                        <br />
                                        <!--
                                        <ucDSTControls:ViewSwitcher runat="server" ID="ViewSwitcher" />-->
                                        <br />
                                        <asp:Label ID="lblCopyRight" CssClass="footer" runat="server" />
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </asp:Panel>
                <script type="text/javascript">
                    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
                    function EndRequest(sender, args) {
                        if (args.get_error() != undefined) {
                            var err = args.get_error();
                            if (err.name == 'Sys.WebForms.PageRequestManagerTimeoutException') {
                                alert('The current request has exceeded the alloted time, please limit your search criteria, or contact your system administrator. Thank you.');
                                args.set_errorHandled(true);
    
                                var prm = Sys.WebForms.PageRequestManager.getInstance();
                                prm.abortPostBack();
                                //location.reload(true);
            
                            }
                        }
                    }
                </script>
            </div>
        </form>
    </body>
    </html>

    Friday, December 20, 2013 12:54 PM
  • User1734617369 posted

    Hi,

    I tried to create a page using your master page and it works without any problem, I had to remove the user controls though since I don't have them. This doesn't give ant real evidence but it seems that the user controls may cause the problems. I tested in Chrome and IE without any issues. Have you tried using the ToolkitScriptManager instead?

    /Johan

    Friday, December 20, 2013 3:13 PM
  • User-159225446 posted

    Really, it works? You don't have your page come back and not work? Were you able to not only create this page but add a content page and another content page to attempt to go to? Any chance you can send me your project so I can try it here? 

    Thanx.

    Friday, December 20, 2013 3:24 PM
  • User1734617369 posted

    Hi,

    Here is the master page:

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="das5.master.cs" Inherits="WebApplication2.das5" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="headMasterPage5" runat="server">
        <meta http-equiv="cache-control" content="max-age=0" />
        <meta http-equiv="cache-control" content="no-cache" />
        <meta http-equiv="expires" content="0" />
        <meta http-equiv="expires" content="Tue, 01 Jan 1990 12:00:00 GMT" />
        <asp:PlaceHolder ID="phfavicon" runat="server">
            <link rel="shortcut icon" type="image/x-icon" href="<%= Page.ResolveUrl(String.Format("~/App_Themes/{0}/Images/favicon.ico", Page.Theme)) %>" />
        </asp:PlaceHolder>
        <title></title>
        <asp:ContentPlaceHolder ID="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body id="masterBody5" runat="server">
        <form id="dasMaster5" runat="server">
            <asp:ScriptManager ID="SMMasterPage5" ScriptMode="Release" runat="server" AsyncPostBackTimeout="10" />
            <div>
                <asp:Panel ID="pnlHeader" runat="server">
                    <!-- Top Header Image Area -->
                    <table cellpadding="0" cellspacing="0" style="width: 100%; margin: 0px; padding: 0px; border: none;">
                        <tr>
                            <td class="dasheaderleftside"></td>
                            <td class="dasheaderslice"></td>
                            <td class="dasheaderrightside">
                                <asp:UpdatePanel ID="upLangSelection" runat="server">
                                    <ContentTemplate>
                                        <table style="width: 100%;">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblLanguageSelection" CssClass="whitelabels" runat="server" />
                                                    <br />
                                                    <asp:DropDownList ID="ddLanguageSelection" CausesValidation="false" AutoPostBack="true"
                                                        runat="server">
                                                        <asp:ListItem Value="en-US" Text="English" />
                                                        <asp:ListItem Value="es" Text="Spanish" />
                                                        <asp:ListItem Value="fr-CA" Text="French Canadian" />
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                        </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <!-- Debug Area -->
                <div id="divDebug" runat="server">
                    <table style="width: 100%;">
                        <tr>
                            <td class="debug">
                                <asp:Label ID="lblDebugTitle" EnableTheming="false" runat="server"
                                    Text="Debug Information: On" />
                                <br />
                                <asp:Label ID="lblSessionID" EnableTheming="false" runat="server" />
                                <br />
                                <asp:Label ID="lblConn" EnableTheming="false" runat="server" />
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- nav menu -->
                <div id="divMainMenu" runat="server">
                    <table cellpadding="0" cellspacing="0" class="mainmenu">
                        <tr>
                            <td id="tdMainMenu" style="text-align: left; vertical-align: middle;" runat="server">
                                <asp:UpdatePanel ID="upDASMenu5" runat="server">
                                    <ContentTemplate>
                                        
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                            <td id="tdLinkButtons" style="text-align: right; vertical-align: middle;" class="whitelabels" runat="server">
                                <asp:UpdatePanel ID="upLinkNavBar" runat="server">
                                    <ContentTemplate>
                                        <asp:Label ID="lblDealer" runat="server" />
                                        <asp:Label ID="lblDASDate" runat="server" />
                                        <asp:LinkButton ID="lnkbtnHome" CausesValidation="false" runat="server" OnClick="lnkbtnHome_Click" />
                                        <asp:LinkButton ID="lnkbtnLogOut" CausesValidation="false" runat="server" OnClick="lnkbtnLogOut_Click" />
                                        <asp:LinkButton ID="lnkbtnHelp" CausesValidation="false" runat="server" OnClick="lnkbtnHelp_Click" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </div>
                <table style="width: 100%; text-align: left;">
                    <tr>
                        <td style="width: 100%; text-align: left;">
                            <!-- mega dealers list -->
                            <div id="divMegaDlrselect" runat="server">
                                <table style="width: 100%; text-align: left;">
                                    <tr>
                                        <td>
                                            <asp:UpdatePanel ID="upcMegaDealerList" runat="server">
                                                <ContentTemplate>
                                                    <asp:Label ID="lblSelectDealer" runat="server" />
                                                    
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
                <!-- core body including menu -->
                <table style="width: 100%;">
                    <tr>
                        <td style="vertical-align: top;">
                            <!-- System Messages -->
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        <asp:UpdatePanel ID="upSystemMessages" runat="server">
                                            <ContentTemplate>
                                                <asp:PlaceHolder ID="phSystemMessages" runat="server" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </td>
                                </tr>
                            </table>
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        <div class="center">
                                            <table style="width: 100%;">
                                                <tr>
                                                    <!-- Body Content -->
                                                    <td>
                                                        <asp:UpdatePanel ID="upMainContentBody5" runat="server">
                                                            <ContentTemplate>
                                                                <div id="divBody" class="bodycell">
                                                                    <asp:ContentPlaceHolder ID="contentBody" runat="server" />
                                                                </div>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upMainContentBody5"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitContentBody" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingContentBody" runat="server" Text="" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress2" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upcMegaDealerList"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitMegaDealerList" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingMegaDealerList" runat="server" Text="" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress3" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upDASMenu5"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaitMenuBar" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessingtMenuBar" runat="server" Text="" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                        <asp:UpdateProgress ID="UpdateProgress4" runat="server" DisplayAfter="1000"
                                                            AssociatedUpdatePanelID="upLinkNavBar"
                                                            DynamicLayout="true">
                                                            <ProgressTemplate>
                                                                <div class="systemWait">
                                                                    <center>
                                                                        <asp:Image ID="ImgPleaseWaituplinknavbar" ImageUrl="Images/spinningimg1.gif" CssClass="systemWaitIMG" AlternateText="" runat="server" />
                                                                        <asp:Label ID="lblProcessinguplinknavbar" runat="server" Text="" />
                                                                    </center>
                                                                </div>
                                                                <div class="systemWaitBkGrd">
                                                                </div>
                                                            </ProgressTemplate>
                                                        </asp:UpdateProgress>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <asp:Panel ID="pnlFooter" runat="server">
                    <asp:UpdatePanel ID="upFooter" runat="server">
                        <ContentTemplate>
                            <!-- footer -->
                            <table class="footer">
                                <tr>
                                    <td>
                                        <asp:Label ID="lblDisclaimer1" runat="server" />
                                        <br />
                                        
                                        <br />
                                        <asp:Label ID="lblCopyRight" CssClass="footer" runat="server" />
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </asp:Panel>
                <script type="text/javascript">
                    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
                    function EndRequest(sender, args) {
                        if (args.get_error() != undefined) {
                            var err = args.get_error();
                            if (err.name == 'Sys.WebForms.PageRequestManagerTimeoutException') {
                                alert('The current request has exceeded the alloted time, please limit your search criteria, or contact your system administrator. Thank you.');
                                args.set_errorHandled(true);
    
                                var prm = Sys.WebForms.PageRequestManager.getInstance();
                                prm.abortPostBack();
                                //location.reload(true);
    
                            }
                        }
                    }
                </script>
            </div>
        </form>
    </body>
    </html>

    and the code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebApplication2
    {
        public partial class das5 : System.Web.UI.MasterPage
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
            protected void lnkbtnHome_Click(object sender, EventArgs e)
            {
    
            }
    
            protected void lnkbtnLogOut_Click(object sender, EventArgs e)
            {
    
            }
    
            protected void lnkbtnHelp_Click(object sender, EventArgs e)
            {
    
            }
        }
    }

    and the content page:

    <%@ Page Title="" Language="C#" MasterPageFile="~/das5.Master" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication2.WebForm2" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="contentBody" runat="server">
        <asp:Button Text="Yes?" ID="Btn1" OnClick="Btn1_Click" runat="server" />
        <asp:Label Text="" ID="Lbl1" runat="server" />
    </asp:Content>
    

    and the code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebApplication2
    {
        public partial class WebForm2 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
            protected void Btn1_Click(object sender, EventArgs e)
            {
                Thread.Sleep(30000);
                Lbl1.Text = "Oki";
            }
        }
    }

    This works for me without any problem.

    /Johan

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 20, 2013 4:14 PM
  • User-159225446 posted

    Ok, I've taken this and added another content page and it does work. Now I need to understand why the few simple user controls interfere witih it, unless something lese is goign on. Thanx.

    Monday, December 23, 2013 9:21 AM
  • User-933407369 posted

    hi chris555 ,

    i think that you need to ASP.NET Page Life Cycle, please refer to the links below:

    FAQ: Sequence that events are raised for Pages, UserControls, MasterPages and HttpModules

    http://forums.asp.net/t/1191194.aspx

    Complete Lifecycle of an ASP.Net page and controls

    http://blogs.thesitedoctor.co.uk/tim/2006/06/30/Complete+Lifecycle+Of+An+ASPNet+Page+And+Controls.aspx

    Hope they can help you.

    Thursday, December 26, 2013 4:26 AM
  • User-159225446 posted

    I don't think this has anything to do with lifecycle of the pages.

    It appears that when I suspend the post, via a "sleep" statement that once my 'Sys.WebForms.PageRequestManagerTimeoutException' is thrown (I set it to 20 seconds and sleep for 50, that the updateprogress display disappears but the "sleep' continues. If I try anything on the screen (i.e link buttons, etc) before the total sleep tim eof 50 seconds is complete the page cycles back to tmy 'Sys.WebForms.PageRequestManagerTimeoutException'??? Not sure why this is occuring yet.

    I'm sure it has something to do with the masterpage having the Javascript for the control 'Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);', and the content page with the actual Ajax call.

    Friday, December 27, 2013 1:47 PM
  • User-159225446 posted

    Ok it looks like that I can successfully cancel the client side post back, and the server side will continue chugging. but the client can't move forward since it is still waiting on the server to respond. Not sure why it is waiting.

    Friday, December 27, 2013 3:15 PM
  • User-159225446 posted

    Ok, After moving the web app to a QA server, it works fine. It appears to have issues working from my development enviroment (VS 2012) workstation, Win 7 IIS 7. 

    So, if anyone else has an issue, that might be the cause.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 30, 2013 9:42 AM