web.config:
<customErrors mode="On" defaultRedirect="~/Foo.aspx" />
When Foo.aspx.cs is running, how can I know that an uncaught exception is what sent me to Foo.aspx?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check the
Server.GetLastError()and also check theResponse.StatusCodeto determine why the page has been called.If you set the
customErrorselement on theweb.configthedefautRedirectpage will only be called when an unknown state occus, that is, if you specify custom pages for status codes 404 and 403, for instance, yourfoo.aspxpage will only be called when a different status appears.