Wonder if anyone can help. I'm trying to implement the ToolScriptManager OnAsyncPostBackError.
The ToolkitScriptManager is on the Masterpage and I've set the OnAsyncPostBackError property:
<ajax:ToolkitScriptManager ID="ToolkitScriptManager"
runat="server" EnablePartialRendering="true"
OnAsyncPostBackError="ScriptManager_AsyncPostBackError">
</ajax:ToolkitScriptManager>
On my content page I'm catching an exception and, logging it and then throwing it
private void LogError(Exception ex, bool full)
{
...
_presenter.LogError(this, error, ex);
throw new ApplicationException(
"Error Occured",
ex
);
}
where it then gets picked up by the handler on the Master Page
protected void ScriptManager_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{
if (e.Exception.Data["GUID"] != null)
{
string _message =
(
e.Exception.InnerException != null
) ? e.Exception.InnerException.Message : e.Exception.Message;
ToolkitScriptManager.AsyncPostBackErrorMessage = _message +
" When reporting this error use the following ID: " +
e.Exception.Data["GUID"].ToString();
}
else
{
ToolkitScriptManager.AsyncPostBackErrorMessage =
"The server could not process the request.";
}
}
This all works as expected, I'm picking up the error via the PageRequestManager EndRequest and displaying on the page
The problem is that I'm getting an Application_Error in my Global.asax stating that an Exception of type 'System.Web.HttpUnhandledException' was thrown.
I kinda get it I think, cause I'm throwing the exception which is not caught by a catch I'm assuming?!
Any advice on what I'm missing, or where in fact I'm going wrong?
Thanks in advance!
Ian