S
Sam Solomon
Dear All,
I am catching a error in my Page_Error event and storing it in a session
variable. After the error is generated the page is redirected to another page
where I want to show complete error details in a label in the Page load event
of the directed page. But the problem is that my session variable seems to be
empty. Below is my code
ErrorPage="WebForm2.aspx" attribute is already set for the following page
which redirects it to WebForm2.aspx
private void Page_Error(object sender,System.EventArgs e)
{
Session["Error"]= Server.GetLastError();
Server.ClearError();
}
In the WebForm2.aspx load event I have :
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Label1.Text="Error" + "<br>" ;
if(Session["Error"]!=null)
{
Exception ex = (Exception)Session["Error"];
Label1.Text+= ex.ToString();}
}
}
In my Web.Config file customErrorMode is set to "On"
When the error is generated its does get redirected to WebForm2. But I
cannt see the Error message in my label.
Any help would be greatly appreciated.
cheers,
Sam Solomon
I am catching a error in my Page_Error event and storing it in a session
variable. After the error is generated the page is redirected to another page
where I want to show complete error details in a label in the Page load event
of the directed page. But the problem is that my session variable seems to be
empty. Below is my code
ErrorPage="WebForm2.aspx" attribute is already set for the following page
which redirects it to WebForm2.aspx
private void Page_Error(object sender,System.EventArgs e)
{
Session["Error"]= Server.GetLastError();
Server.ClearError();
}
In the WebForm2.aspx load event I have :
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Label1.Text="Error" + "<br>" ;
if(Session["Error"]!=null)
{
Exception ex = (Exception)Session["Error"];
Label1.Text+= ex.ToString();}
}
}
In my Web.Config file customErrorMode is set to "On"
When the error is generated its does get redirected to WebForm2. But I
cannt see the Error message in my label.
Any help would be greatly appreciated.
cheers,
Sam Solomon