Try catch (globally)

  • Thread starter Thread starter Leo R
  • Start date Start date
L

Leo R

Hi al,

An error is thrown in a certain aspx-page; let's say page1.aspx. As a result
of the Web.config seting for errors the user is redirected to error.aspx
because of the (unhandled) error in page1.aspx. I want to process the
stacktrace of the error that was thrown in the page1.aspx or any other page
in my webapplication in the page 'error.aspx'. How can I do that?

Leo R.
 
Try using the Application_Error method in Global.asax.cs

Example:

protected void Application_Error(Object sender, EventArgs e){

Exception lastException = Server.GetLastError();

// do something with lastException

}

Jamey...
 
Hi Leo,

Firstly I want to thank Leo for his great help in this issue. Please check
his response carefully.

In addition, I believe that the following article is useful to you.

Web Application Error Handling in ASP.NET
http://www.15seconds.com/issue/030102.htm

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Jamey,

Thanks a lot! This is exactly what I was looking for.

Leo R.

message Try using the Application_Error method in Global.asax.cs
Example:
protected void Application_Error(Object sender, EventArgs e){
Exception lastException = Server.GetLastError();
// do something with lastException
}
Jamey...
 
Back
Top