I always used the following two bits of code (which are used to work) to catch Ajax asyncPostBackErrors.
<asp:ScriptManager ID="ScriptManager1" runat="server" OnAsyncPostBackError="ScriptManager1_AsyncPostBackError" />
and
protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{
ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message;
}
But now, despite the fact that an unhandled exception fell into this function of the event handler, and AsyncPostBackErrorMessagewas installed with an exception message, I always get the same error message on the page in the warning field, regardless of whether the exception message was, saying:
Error: Sys.WebForms.PageRequestManagerParserErrorException: The message recieved from the server could not be parsed. Common causes for this error are when the response is modified by calls to the Respnse.Write() ....
Error - the same error you would get if you had an unhandled exception asyncPostBackand you didn’t include the event handler method Scriptmanger's asyncPostBackError.
No matter what I do, I get the same error. What could be the reason for this?
user202357