Question

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).

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top