S
SMG
Hi All,
I am using following code in web.confiig for trapping all the error through
out my site..
<customErrors mode="On" defaultRedirect="WebForm1.aspx">
<error statusCode="404" redirect="ServerError.aspx"></error>
<error statusCode="500" redirect="WebForm3.aspx"></error>
</customErrors>
It works very fine... but On the final page e.g WebForm3.aspx I want catch
the error and want to show it on the screen.
so i wrote following code in webform3.aspx
string strErrorMsg = "Application Error\n\n";
// Get the path of the page
strErrorMsg += "Error in Path :" + Request.Path;
// Get the QueryString along with the Virtual Path
strErrorMsg += "\n\n Error Raw Url :" + Request.RawUrl;
// Create an Exception object from the Last error
//that occurred on the server
Exception myError =Server.GetLastError();
// Get the error message
strErrorMsg += "\n\nError Message :" + myError.Message;
Regards,
Shailesh Gajare
I am using following code in web.confiig for trapping all the error through
out my site..
<customErrors mode="On" defaultRedirect="WebForm1.aspx">
<error statusCode="404" redirect="ServerError.aspx"></error>
<error statusCode="500" redirect="WebForm3.aspx"></error>
</customErrors>
It works very fine... but On the final page e.g WebForm3.aspx I want catch
the error and want to show it on the screen.
so i wrote following code in webform3.aspx
string strErrorMsg = "Application Error\n\n";
// Get the path of the page
strErrorMsg += "Error in Path :" + Request.Path;
// Get the QueryString along with the Virtual Path
strErrorMsg += "\n\n Error Raw Url :" + Request.RawUrl;
// Create an Exception object from the Last error
//that occurred on the server
Exception myError =Server.GetLastError();
// Get the error message
strErrorMsg += "\n\nError Message :" + myError.Message;
Regards,
Shailesh Gajare