How to set custom error pages


By editing the web.config file you can redirect users that encounter 404 or 500 errors to custom pages



  • Access to the DNN file structure and server.



When browsing for a resource such as a .txt or .asp that does not exist you will receive the static 404 page.

Note this also will fix receiving the static page for searching /bin or /web.config

Static 404 page:




  1. Inside of the web.config file in your DNN root directory, you will need to find the <system.webServer> tag.
  2. Add the following inside of the tag:
    <httpErrors errorMode="Custom">
    <remove statusCode="404" subStatusCode="-1" />
    <remove statusCode="500" subStatusCode="-1" />
    <error statusCode="500" prefixLanguageFilePath="" path="" responseMode="Redirect" />
    <error statusCode="404" path="" responseMode="Redirect" />
    In the path attribute, you can set the absolute URL of the custom error page that you will be redirecting your users to.
  3. Save the web config and now when you browse to the same page that produced the static 404 you will see the DNN 404 page.




To test that the user is correctly redirected to the correct error page:

  • Go to any page that does not currently exist for your site. You should be able to see the custom error page.


1 comment

  • Avatar
    Balazs Varga

    NOTE: If the "Error Pages" feature is not installed in IIS, this will not work.

    In such case, run the powershell command "Install-WindowsFeature web-http-errors" and restart IIS. 

    Under "Error Pages" it is then possible to configure the same in the IIS GUI, and it will put the httpErrors in the web.config.

    Comment actions Permalink

Please sign in to leave a comment.