Last post Mar 04, 2008 11:32 AM by Idsa
Feb 27, 2008 07:29 PM|Idsa|LINK
I handle unhandled exceptions at application level using <customErrors> attribute of webconfig. At error page I use automatically created GET variable aspxerrorpath, but it contents the address of the page without GET variables. So my question is how to
get GET variables of the page with exception. Is there any way?
Feb 29, 2008 06:19 AM|Hua-Jun Li - MSFT|LINK
Do you want to use the Get variable aspxerrorpath?
You can try the following code.
protected void Page_Load(object sender, EventArgs e)
Also, you can get the error page path and error message at Global.asax
void Application_Error(object sender, EventArgs e)
Exception LastError = Server.GetLastError();
String ErrMessage = LastError.ToString();
String LogName = "MyLog";
String Message = "Url " + Request.Path + " Error: " + ErrMessage;
Let me know if I have misunderstood what you mean.
Hope it helps,
Feb 29, 2008 10:09 AM|Idsa|LINK
At first post I wanted to know how to get access to the url which generated the error.
I decided to save the Context.Request.RasUrl property into Session and then get it at error page. Something like that:
protected void Application_Error(Object sender, EventArgs e)
Context.Session["ErrorPage"] = Context.Request.RawUrl;
Mar 04, 2008 11:32 AM|Idsa|LINK
Also I would like to add that using Session at Application_Error is possible only if exception is generated after AcquireRequestState event (where Session becomes available).