1

I have a classic ASP page that sets the response header to 404 Not Found plus some you might be interested in links:

Response.Clear
Response.Status = "404 Not Found"
Response.Write "<h1>Oops</h1>"
Response.Write "<p>The page you requested was not found</p>"
Response.Write "<p>But we have some suggestions:</p>"

This code ran fine on IIS6 i.e. it sent correct response code plus the content. However, on IIS7, all I get is this:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

How can I make IIS show my content without changing configuration (if possible).

1 Answer 1

2

Firstly, ensure that the application pool for the site is running in "Classic Mode". To set this, select the application pool for the site in IIS, click "Basic Settings..." and set "Managed pipeline mode" to "Classic".

Next, select the site in IIS and, click the "Error pages" icon. Click "Edit Feature Settings..." and make sure "error responses" is set to "Custom Error Pages".

You should then find you can set the 404 error to execute your ASP page.

Sign up to request clarification or add additional context in comments.

1 Comment

I have a similar bit of code, and it's worked for several days- and then I came to try it today and got a 500 - internal server error status instead. It boggles me slightly that, in a file that is a custom 404 handler, you still have to explicitly set the status to 404, but that's another issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.