In my web.config I have:
<customErrors mode="On" defaultRedirect="~/Error.aspx" redirectMode="ResponseRewrite">
<error statusCode="500" redirect="~/Error.aspx" />
<error statusCode="404" redirect="~/404.aspx" />
</customErrors>
Yet with these URL's, only the 2nd one with file extension defined works, the other one returns the blue screen 404 "Server Error in Application".
http://127.0.0.1/scirranew/invalidpath
http://127.0.0.1/scirranew/invalidpath.aspx
Any ideas? I'm on ASP.net 4, IIS 7.5.
Best Answer
If you want this to work, you need to configure IIS to pass all requests to the .NET engine. Your first example is not obviously asking for a .NET page, so it is not routed to the .NET engine.
What version of IIS and .NET are you using? This may help.