Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got an IIS6 server that is returning 200 when I have my custom 404 page set (Set to be URL /404.htm).

Reading up on it, it seems that if I use the 'file' option instead, it will return an actual 404 status code.

However, I want to be able to set this for all websites on my server (a few hundred), so I want to be able to use a relative path.

When using IIS Manager, it only allows me to pick an absolute path.

share|improve this question

Since it's IIS, can you simply drop a file in the root of each website? (would probably be easy with a batch file).

This file would be a web.config file (used in ASP.NET)

The code in the web.config would look like this.

<?xml version="1.0"?>
        <customErrors mode="On" redirectMode="ResponseRewrite">
            <error statusCode="404" redirect="http://localhost/404.htm" />

Then you make another website in IIS that hosts your 404.htm file, and have it executed at localhost

Alternatively you can create a 404.aspx file and wire it up as your 404 error page (instead of the 404.htm). This file would look something like this.

<%@ Page language="c#" %>
   <script language="CS" runat="server">
      void Page_Load(object sender, System.EventArgs e) 
          // here were actually telling the browser that the page is 404 and not 200
          Response.Status = "404 Not Found";
          Response.StatusCode = 404;
   <title>404: Whoops, we lost your file.</title>
    <div>Oops, the resource you are looking for is unavailable</div>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.