M
Mike Hixson
Hi,
In my application I have a lot of functions that use a try.. catch to to
write execption info to a label at the top of my page. Is there anyway that
I could do this at a page-level, instead of a try..catch in every function.
My goal is to allow users to see the execption (like "you cant delete this
from the database") on the page that caused the exception. I dont want to
redirect the users to another page and show an error.
I though something like this would work, but it turns out that the page
dosent render after an exception.
private void Page_Error(object sender, EventArgs e)
{
ErrorMessage.Visible = true;
ErrorMessage.Text = Server.GetLastError().Message;
Server.ClearError();
}
I even tried calling prerender and render in Page_Error, which got me what i
wanted but subsequest requests failed with an error saying that the
viewstate was invalid . Does any know if this is posible?
-Mike
In my application I have a lot of functions that use a try.. catch to to
write execption info to a label at the top of my page. Is there anyway that
I could do this at a page-level, instead of a try..catch in every function.
My goal is to allow users to see the execption (like "you cant delete this
from the database") on the page that caused the exception. I dont want to
redirect the users to another page and show an error.
I though something like this would work, but it turns out that the page
dosent render after an exception.
private void Page_Error(object sender, EventArgs e)
{
ErrorMessage.Visible = true;
ErrorMessage.Text = Server.GetLastError().Message;
Server.ClearError();
}
I even tried calling prerender and render in Page_Error, which got me what i
wanted but subsequest requests failed with an error saying that the
viewstate was invalid . Does any know if this is posible?
-Mike