XMLHttp Panel post fails with 404...app_offline trick

2 posts, 0 answers
  1. Doug Swanson
    Doug Swanson avatar
    5 posts
    Member since:
    Jan 2008

    Posted 25 Jun 2010 Link to this post

    I have a telerik radgrid inside of an xmlhttp panel that I refresh at a given interval with the following javascript...
    function startWorklistRefresh() {
                    if (wlIntervalId == 0) {
                        wlIntervalId = setInterval("reloadWorklist();", wlCtrlAutoRefreshRate);
                    }
                }
                function reloadWorklist() {
                    $find("<%= XmlGridPanel.ClientID %>").set_value("Reload");
                }
    function OnClientResponseError(panel,args){
        alert('wtf');
    }

    We update our site using the app_offline.htm trick for IIS. The problem is that I can see (via FF/Firebug) the reloadworklist happening but there are 404 errors happening (as expected) when I take the site offline...but the user is does not see our app_offline page..I tried adding a clientside event for OnClientResponseError but that event was never hit...what I would like to have is a hook so I can redirect the user to some default.aspx page...I also tried the custom errors web.config but apparently that doesn't take effect for an xmlhttppanel request...any help would be greatly appreciated.

    thanks
    ds


  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 30 Jun 2010 Link to this post

    Hello Doug,

    The XmlHttpPanel uses ASP.NET Callback mechanism to update its content. How the XmlHttpPanel will behave in such scenario (when app_offline.html is present in the root directory) will entirely depend on the ASP.NET Callback mechanism. The callback is initiated using the WebForm_DoCallback method, which takes as an argument the javascript method that will be invoked if an error occurs. Basically, if an error occurs you will be able to handle the OnClientResponseError client-side event of the XmlHttpPanel, but an error is not thrown and the event is not fired.
    I tried several approaches to track whether the application is offline, in the code behind, but to no avail.
    Here is what I tried:
    protected void XmlPanel1_ServiceRequest(object sender, Telerik.Web.UI.RadXmlHttpPanelEventArgs e)
    {
        Response.StatusCode = 404;
         
        if (Response.StatusCode != 200)
        {
            throw new Exception("Application Offline!");
        }
    }

    I will continue investigating the issue, and if anything comes up I will follow-up in this thread. If you find a solution, could you please share it with us? I am sure it will be of help to other members of the community.

    Best wishes,
    Pero
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top