Exceptions

T

tshad

I am setting up some exception handling and was wondering if the
Application_Error in the Global.asax is different than the customerErrors in
web.config.

Sub Application_Error(Sender As Object, E as EventArgs)
Dim LastException as String = Context.Error.ToString()

Context.ClearError()

response.Redirect("/PageError.aspx")
response.Redirect("/PageError.aspx?Err=" &
Server.GetLastError().ToString())
response.Redirect("/PageError.aspx?Err=" &
Server.UrlEncode(LastException))
response.Redirect("/PageError.aspx?Err=" & LastException)
End Sub


or

<customErrors mode=on defaultRedirect="/PageError.aspx">

Would you use only one or the other or would you use both?

If you were to use both, which one gets handled first?

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,592
Members
45,104
Latest member
LesliVqm09
Top