I'm trying to handle uncaught exceptions in my Global.asax's Application_Error event. It currently looks like
Sub Application_Error(ByVal sender as object, ByVal e as EventArgs)
Server.ClearError()
Response.Redirect("~/ErrorPages/GenericError.aspx")
End Sub
Throwing a brand new exception in the Page_load of another page with
Throw New Exception()
What ends up actually happening is that execution never leaves the source page, and throws the default asp error page citing my exception. Why isn't it being sent to my error page?
EDIT: fixed Response.Redirect
. Now looks like:
Response.Redirect("http://mysite/ErrorPages/GenericError.aspx")
Also made the change to my web.config
file that was suggested by krshekhar suggested. While I am now being sent to my error page, it is using the default redirection instead of the one I feed it in Application_Error
. Any other thoughts?