Search code examples
asp.netiisiis-7http-status-code-404.net-4.8

Custom Page 404 isn't shown on server (asp .net framework 4.8)


On our websites as someone visits a non-existing page, we dinamically create a 404 error page that returns a status code 404.

It works perfectly on localhost, but on the server the same page returns the standard 404 IIS (7.0) error (IISError) instead of the custom one CustomError.

We can't edit the web.config file because we don't have a physical page to redirect to.

Is it possible that there is a IIS configuration that prevents our custom error page from showing?


Solution

  • There is a configuration setting in IIS. Click your application in IIS, and find Error pages settings.

    enter image description here

    For the error code, you could specify location of your custom page.