Try catch (globally)

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.
 
J

Jamey McElveen

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...
 
J

Jacob Yang [MSFT]

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.
 
L

Leo R

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...
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top