Search code examples
asp.netiis-8windows-server-2012-r2custom-error-pages

How can I make custom error pages pop up instead of default browser ones?


I am trying to make my ASP.NET site in IIS display a custom error page when the correct HTTP error response occurs.

I have put all my error pages in the .NET Error Pages section of IIS on my server and on the correct site, yet it still gives me the browser not found page if I go to something that does not exist.

All comments are appreciated

The error page that shows if I go to a page that does not exist


Solution

  • You can try using iis url rewrite, which redirects your current error page to a custom error page. The following rule you can use as a reference

    <rule name="Redirect to custom error page">
      <match url=".*" />
      <action type="Redirect" url="your custom error page url" redirectType="Found" />
    </rule>