Custom error handling for a specific page in ASP.Net

kevsnell

New Member
On a site I run, I have 404's and 500 errors mapped to redirect to a custom error page for end users; using the following code in my web.config:\[code\] ... ... <system.web> <customErrors defaultRedirect="/404/default.aspx" mode="RemoteOnly"> <error statusCode="404" redirect="/404/default.aspx" /> </customErrors> ... ...\[/code\]However, I have one specific page that I do not want redirected; a health check page to make sure the site is 100% operational. I tried setting a location specific custom error handler using the code below in my web.config:\[code\] ... ... </system.web> <location path="health.aspx"> <system.web> <customErrors defaultRedirect="" mode="RemoteOnly"></customErrors> </system.web> </location> ... ...\[/code\]However, it doesn't seem to work. When I rename health.aspx to something else like badhealth.aspx, then make a request, I expect to get a generic 404 error via the Yellow Screen of Death page. Similarly, by intentionally changing the code to throw an error, I should get 500 error via the YSOD page. In both cases, I end up being redirected to our custom 404 page, rathen then getting a YSOD. Thoughts?Any assistance is greatly appreciated.Thanks all,- Frank
 
Back
Top