IIS 404 custom error

Posted by Greg B on Server Fault See other posts from Server Fault or by Greg B
Published on 2009-12-21T15:58:28Z Indexed on 2010/03/11 4:41 UTC
Read the original article Hit count: 449

I've deployed an ASP.NET 3.5 app to a 64bit Windows 2003 R2 server.

In the web.config I have the following

<customErrors mode="RemoteOnly"
              defaultRedirect="/404/">
  <error statusCode="404"
         redirect="/404/"/>

  <error statusCode="500"
         redirect="/500/"/>
</customErrors>

In the website properties in IIS Manager I have set the 404 and 500 errors to Type = "URL" and the same URLs as in the web.config.

I have a wildcard application map to the .NET 2.0 aspnet_isapi.dll with "Verify file exists" turned off.

If I try to hit a fake .aspx file I successfully get sent to the 404 page. I belive this is because there is an explicit mapping for .aspx to the .NET DLL.

If I try to access a fake directory I simply recieve a plain text response saying:

The system cannot find the file specified.

It would appear that these requests for directories are not being routed through the .NET pipeline, which is what I would expect (and need) to happen becuase of the wildcard application mapping.

Any ideas?

© Server Fault or respective owner

Related posts about iis6

Related posts about custom-errors