R
robertlair
I am having issues with a production server with the GetLastError()
method. Here is what I am doing:
Application_Error on Global ASAX:
Note: I am doing it this way (with ClearError) because while
researching, someone on a post said that Session state would not
persist unless I cleared the error... didn't make sense, but it also
didn't work before I put this in there too.
Exception ex = Server.GetLastError();
Server.ClearError();
Session["LastError"] = ex;
Response.Redirect("CustomErrorPage.aspx");
Then, on the Custom Error Page:
Exception ex = (Exception)Session["LastError"];
// displaying and emailing exception details
On my developer machine, this works just fine, but on the production
server the Session["LastError"] ALWAYS returns null. As a result, I
cannot get to any of the exception details. I also tried doing all of
this in the global asax, but there the GetLastError() is STILL null!
Makes no sense to me how on the Application_Error method the first line
of code is GetLastError() and it returns null. Any ideas?
method. Here is what I am doing:
Application_Error on Global ASAX:
Note: I am doing it this way (with ClearError) because while
researching, someone on a post said that Session state would not
persist unless I cleared the error... didn't make sense, but it also
didn't work before I put this in there too.
Exception ex = Server.GetLastError();
Server.ClearError();
Session["LastError"] = ex;
Response.Redirect("CustomErrorPage.aspx");
Then, on the Custom Error Page:
Exception ex = (Exception)Session["LastError"];
// displaying and emailing exception details
On my developer machine, this works just fine, but on the production
server the Session["LastError"] ALWAYS returns null. As a result, I
cannot get to any of the exception details. I also tried doing all of
this in the global asax, but there the GetLastError() is STILL null!
Makes no sense to me how on the Application_Error method the first line
of code is GetLastError() and it returns null. Any ideas?