By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,835 Members | 1,454 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,835 IT Pros & Developers. It's quick & easy.

Error Handling

P: n/a
A.M
Hi,

I have this code in my web.config:

<customErrors mode="On" defaultRedirect="~/ErrorPages/ErrorApp.aspx">
<error statusCode="400" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="401" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="403" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="404" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="408" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="500" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="503" redirect="~/ErrorPages/Error.aspx" />
</customErrors>

Is there any way that inside Error.aspx code I can find what was the actual
error number?

Thanks,
Al
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
The customErrors mode results in a redirect (round trip) when an error
occurs, and since the client comes back with a new request for the
error page, the error information will be lost.

My suggestion is to implement a global error handler in the
Application_Error event handler in global.asax. From here you can
redirect or Server.Transfer to another page after you have collected
the exception information.

More details in the following article:
HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual
C# .NET
http://support.microsoft.com/default...306355&SD=MSDN

HTH,

--
Scott
http://www.OdeToCode.com
On Thu, 29 Apr 2004 14:17:17 -0400, "A.M" <IH*******@sapm123.com>
wrote:
Hi,

I have this code in my web.config:

<customErrors mode="On" defaultRedirect="~/ErrorPages/ErrorApp.aspx">
<error statusCode="400" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="401" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="403" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="404" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="408" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="500" redirect="~/ErrorPages/Error.aspx" />
<error statusCode="503" redirect="~/ErrorPages/Error.aspx" />
</customErrors>

Is there any way that inside Error.aspx code I can find what was the actual
error number?

Thanks,
Al


Nov 18 '05 #2

P: n/a
Hi Al,

I'm viewing this thread and found that there is another duplicated one in
this queue. A community member has provided a good solution that using the
querystring param to provide the Error code info. Also I've provided some
of my suggestions there. I'd appreciate if you'd have a look. Also, if you
feel it convenient that we continue to discuss in that thread, please feel
free to follwoup there. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.