Handling 404 Errors in Development

How to handle 404 errors when running code on development computer

For some time now (since I moved to Windows 10 for my development environment) I've failed to get 404 error handling to work.  But as it hasn't been a major issue, I've ignored it.

Today I needed it to work, and I've finally discovered why it didn't.  It was due to the following being missing...

<system.webServer>
<httpErrors errorMode="Custom">
  <remove statusCode="404" subStatusCode="-1" />
  <error statusCode="404" path="/Error/404.aspx" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>

The key part is the errorMode="Custom" which forces the handling on the local machine, otherwise the default is that only requests from locations other than the local machine are dealt with

Added 16/01/2019 14:20