Hi all, I expect this post to be answered because the previous two are still out there (one I solved it myself). Here is my question: Inside the Commerce Starter Kit, I want to redirect the user to a custom error page if the application fails unexpectedtly.
In this custom error page I want to get the error message of the exception that has been thrown. This is the application error handling section in my global_asax.cs file:
Exception ex = Server.GetLastError();
Session.Remove("LAST_ERROR");
Session.Add("LAST_ERROR", ex.InnerException);
Server.ClearError();
Response.Redirect("~/ErrorPage.aspx");
The next one is the Page_Load code of the ErrorPage.aspx:
My problem is that when I get the exception from Session, it's null, although before redirecting, in Global_asax, has the exception value.
Of course, I've turn on Session State in the web config file as follows:
Does anybody see the problem? I do not. I need urgent help please. What do I have
to put on the CustomErrors tag pf the web.config? I've tried "RemoteOnly", "Off" and "On" but doesn't work at all. The strangest situation is that I've used this custom error handling in another web projects, and wordked perfectly. Could be something strange
or peculiar related to how the Commerce Starter Kit is built? I forgot to say that I don't want to use Querystring in order to pass the error message from Global_asax to ErrorPage.aspx. This works perfecly but I don't like it. Thanks in advance.
MIGUELÓN.
-----------------------------------------
Rezad a vuestros dioses, amad a vuestras mujeres y luchad por vuestra patria!
----------------------------------------
lonifasiko
Member
355 Points
71 Posts
Custom error handling
Feb 02, 2005 02:26 PM|LINK
Exception ex = Server.GetLastError(); Session.Remove("LAST_ERROR"); Session.Add("LAST_ERROR", ex.InnerException); Server.ClearError(); Response.Redirect("~/ErrorPage.aspx");The next one is the Page_Load code of the ErrorPage.aspx: My problem is that when I get the exception from Session, it's null, although before redirecting, in Global_asax, has the exception value. Of course, I've turn on Session State in the web config file as follows: Does anybody see the problem? I do not. I need urgent help please. What do I have to put on the CustomErrors tag pf the web.config? I've tried "RemoteOnly", "Off" and "On" but doesn't work at all. The strangest situation is that I've used this custom error handling in another web projects, and wordked perfectly. Could be something strange or peculiar related to how the Commerce Starter Kit is built? I forgot to say that I don't want to use Querystring in order to pass the error message from Global_asax to ErrorPage.aspx. This works perfecly but I don't like it. Thanks in advance.-----------------------------------------
Rezad a vuestros dioses, amad a vuestras mujeres y luchad por vuestra patria!
----------------------------------------