Atlas and Custom Errors
If you use Atlas versions of ASP .NET AJAX, it is a known fact that you cannot redirect the user server-side from an event raised by a control that is in an Update Panel. We can find ways to deal with this problem, but what happens in the particular case of Errors?
Error handling code often implies using Application_Erorr function in Global.asax and automate redirection to a page where an error message is posted - "An error has occurred. The administrator has been notified" is my favourite :) (with DB logging of course)
If an error occurs within a post-back triggered by a control in an Update Panel, we may be surprised to see that the user is not redirected anywhere and the error is shown in an alert message box.
Solutions? First of all, let the error be handled by the Application_Error code. For that you can use one of the Script Manager events. There you just throw the exception:
Protected Sub ScriptManager_PageError(ByVal sender As Object, ByVal e As Microsoft.Web.UI.PageErrorEventArgs) Handles ScriptManager.PageError
Throw e.Error
End Sub
Second, you would also like the redirect to work - unfortunately, only .NET Ajax offers a solution for that - the Script manager has a property called AllowCustomErrors that, when set to true, allows the application to handle errors through the Custom Errors settings in web.config. More details here.










Recent Comments
Starting form the sample I mentioned
Thanks for posting this. It sav
The left image does not overlap t
Was Looking for the "inline" and "at