views:

190

answers:

2

I use an updatepanel and I register a handler for endRequest to catch errors:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

On the server an exception is thrown to test the client side. The problem is that in IE and FireFox EndRequestHandler is never called! It works as expected in Opera and Safari.

On a simple page with few controls it works as expected in all browsers. What I found out with Firebug is that the response is Content-length: 67, but there is no response (empty tab for response)! The expected response is

53|error|500|Object reference not set to an instance of an object.|

for example.

I have not debugged the ajax library precisely but what I have seen is that some code runs to prepare for pageLoading event (maybe because it cannot detect the error?), but there is no information for updatepanels from the response and an error occurs trying to use an object for updatepanels which is null. The error is caught by a try-finally block.

So, there may be something on the server (in the asp.net page) that causes the problem, but I couldn't find it. Could someone help me?

A: 
  1. Empty tab for response is Firebug's bug. I ran into it too.
  2. Try to update to the latest version of MS Ajax: http://ajax.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=35895
thorn
1. I don't know if it is a bug, because in IE debugger I have seen that responseText of the XMLHttpRequest object is an empty string!2. I will try this.
andreyu
A: 

The same problem still exists with the latest MS Ajax.

I managed to solve the problem on the server:

protected override void OnError(EventArgs e)
{
    base.OnError(e);
    if (ScriptManager.GetCurrent(this).IsInAsyncPostBack)
    {
        Response.Clear();
        Response.Write("53|error|500|Bad.|");
        Response.Flush();
    }
}

Thus, I think something on the server side is wrong.

andreyu