What I do for my error logging. (psuedo code)
Application_Error
Exception ex = Server.GetLastError();
Server.ClearError();
LogError( ex );
Session["ApplicationError"] = ex; //this will save it in session so I can
pull it from the
Response.Redirect( "ErrorPage.aspx", true ); //I am sure you could use
Server.Transfer, but we don't use Server.Transfer.
--in my ErrorPage
Page_Load
Exception ex = Session["ApplicationError"] as Exception
//display the exception.
This isn't exactly what I do; I switch off the exception type and have
different directions depending on the type of error.
bill
"Steve Taylor" <Re************@laborready.com> wrote in message
news:O8**************@TK2MSFTNGP15.phx.gbl...
So you're say that I should immediately execute "Server.ClearError()" and
then within my error processing page access the most recent error by by
calling Server.GetLastError()?
"William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message
news:Og*************@TK2MSFTNGP12.phx.gbl... In your Application_Error, you need to call Server.ClearError() or the
error will still be sitting there and be sent to the default error page.
Server.GetLastError() will also return the exception chain that caused
the error.
HTH,
bill
"Steve Taylor" <Re************@laborready.com> wrote in message
news:u%****************@tk2msftngp13.phx.gbl...
Here's what happening:
- I have a global error trap set in global.asax defined as:
protected void Application_Error(Object sender, EventArgs e) {
HttpContext.Current.Server.Transfer("/salesnow/errors/SalesNow_Error.aspx");
}
- My users are on occassion are getting the error:
"Server Error in '/Salesnow' Application - Request timed out."
- No aspx page is referenced anywhere in the *ugly* default error page.
- My error trap is designed to e-mail me notices of errors.
- I am seeing about twice as many errors logged in the Win2003 PerfMon
window for the web servers (as e-mails).
- Is this happening because my re-directed error page is timing out?
What is the best way to trap for this?
TIA,
Steve