How can I handle ALL 404 errors?
If I goto a page that does not exist
Example: http://www.example.com/Idontexist.aspx
It works fine..
However, http://www.example.com/Nothere.nope or http://www.example.com/NotHere gives a 404.0 error, I think its due to .nope not registered in IIS, but would there be a way to handle this in the web.config or in code?
This likely because
notthere.nopeisn’t passing through .NET. Depending on the version and configuration of IIS, ASP.NET is only used to execute requests with specific extensions.Ideally, you should trying handling 404’s at the IIS level – there is no point in letting it bubble up that far the application stack. This would be my recommendation.
If you really want ASP.NET to be able to handle this, you can If you are using IIS 7 there is a nice write-up on that here.
If you are using IIS 6, you can use a wildcard mapping to the ISAPI extension as described here here.