How can I make it return a custom ASP.NET page with an error code of 404? Currently it doesn’t do that when I set the
<customErrors mode="On">
<error statusCode="404" redirect="~/UtahDisclosures.aspx" />
</customErrors>
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.
This seems to be a quirk of ASP.NET and one that I was unnaware of before reading your post.
However, a quick Google turned up this blog post: http://www.digitallycreated.net/Blog/57/getting-the-correct-http-status-codes-out-of-asp.net-custom-error-pages
They seem to know what they’re on about and suggest using this:
<% Response.StatusCode = (int)HttpStatusCode.NotFound; %>along with some other key steps (see the link).Also, when sending custom error pages, you might need to bear this IE minimum error page size quirk in mind.