Click here to Skip to main content
15,923,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
An academic question right now, but my curiosity has been piqued.

Is there any way to capture the HTTP sub-code, if any, when writing a custom error page? The customErrors block in web.config allows only for integer status, so I cannot distinguish between, say, 403.4 and 403.14. And I haven't been able to find an exception with this information that I could intercept in Application_Error. Specifically, I would like to redirect all 403 errors to a single page and have that one page describe the specific "Access Denied" error.

Is this possible?
Posted

1 solution

This should do it:

C#
HttpContext.Current.Response.SubStatusCode;
 
Share this answer
 
Comments
Gregory Gadow 15-Jun-10 10:15am    
My apologies for not responding sooner ([censored] job.) Thanks, this is exactly what I was looking for.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900