• Got a Tipila, google, windows live or facebook account ?

This is the correct (and the only working) way to use custom error pages in ASP.NET MVC. This sends the correct http status code along with the error page and nothing else worked for me.

Add following to turn off custom errors (in system.web) of web.config

<customErrors mode="Off" />

Then add the following to the system.webserver section of the web.config

 <httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="404" subStatusCode="-1" />
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="404" path="Error404.html" responseMode="File" />
  <error statusCode="500" path="Error.html" responseMode="File" />
</httpErrors>

This removes the IIS default error pages and use the provided pages instead.

Note - Use responsemode= "file" if the url is a direct link to a file or use executeUrl if it's a url

1
votes
Login to Tipila