IIS 10 Custom 404 Error pages not working

aspasp-classichttp-status-code-404windows 10

Windows 10, IIS 10, Classic ASP, .NET v2.0 Classic

Custom 404 Error pages that have been working on my test machine for years, with Windows 7, no longer work within Windows 10's IIS.
I set everything up in IIS Error Pages.

This is my code from the web.config file.

<httpErrors errorMode="Custom" defaultPath="/MyDomain.org/error/404.asp" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/MyDomain.org/error/404.asp" responseMode="ExecuteURL" />
</httpErrors>

This is a virtual site, within IIS, so the domain name has to be present.
It does not work. I load the page, and the only thing I get is.

This 192.168.2.12 page can’t be found

No webpage was found for the web address:
http://192.168.2.12/ask/ASP_Classic/

I need to test these pages for an update to our site. Any idea's on what has changed in IIS 10, that would have caused the 404 Pages to no longer work?

Best Answer

OK. I was messing around inside of the new IIS in Windows 2016 Server, and I was able to get the custom ASP Error pages to work in it, without an issue. I tested two methods.

1: The folder path: /MyDomain.com/error/404.asp

2: The Virtual Directory name: /MySite/error/404.asp

And they both worked great.

I went back into Windows 10, and IIS 10 and changed the path from the Folder Name to the Virtual Directory Name, and wa-la. It worked.

So, with the new IIS 10 inside of Windows 10, you have to use the Virtual Directory Name, instead of the Folder Name.

This is how to looks.

<httpErrors errorMode="Custom" defaultResponseMode="File">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/Mysite/error/404.asp" responseMode="ExecuteURL" />
</httpErrors>

Now, off to testing.

Wayne