hi,
i'm having some trouble with my global.asax file,
i'm trying to write my own method in there to raise an error, and then
use Response.Redirect to redirect it to an error page, to display the error message ....
the logic is quite simple, but when i use the session i always get
"Session state is not available in this context"... and i really don't know why?
and i don't know what to do..
below is my code...
any help would be appreciated..
i'm having some trouble with my global.asax file,
i'm trying to write my own method in there to raise an error, and then
use Response.Redirect to redirect it to an error page, to display the error message ....
the logic is quite simple, but when i use the session i always get
"Session state is not available in this context"... and i really don't know why?
and i don't know what to do..
below is my code...
any help would be appreciated..
Code:
object user = (object)Session["Info"];
Session.Clear();
Session["Info"] = user;
Session["ErrorMessage"] = ErrorMessage;
// this part to show a home button in the error page
if (ShowHomeButton)
Session["ShowHomeButton"] = 1;
else
Session["ShowHomeButton"] = 0;
// this part to redirect to the error page
Response.Redirect("~/ErrorPage.aspx");