Custom Error Documents and Custom 404 Errors in DotNetNuke

DNN > How To
Custom Error Documents and Custom 404 Errors Warning:  Error documents can only be configured on a per-DotNetNuke install basis and can not be configured on a per-portal basis.

When working with a DotNetNuke website, there are two types of error pages that exist:
IIS Error Pages: These error pages handle IIS-level errors such as when a request goes to an HTML file that does not exist
ASP.NET Error Pages: ASP.NET error pages handle ASP.NET errors and are managed separately from IIS error pages
Configure IIS Error Pages

See How to Determine Which Version of Plesk Control Panel is Installed on a Server to know which set of directions to follow.

 
Verify that Custom Error Documents are Enabled - Plesk 12.x
  1. Log into the Plesk Control Panel.Select your domain.
  2. Click the Subscriptions tab, click your domain.
  3. Click the Websites & Domains tab.
  4. Next to the domain name, click on Hosting Settings.
  5. Check the Custom error documents check box.
  6. Configure the custom error documents.
    1. Under the Websites & Domains tab, click Show More.
    2. Click Virtual Directories.
    3. Click on Error Documents.
    4. Click on the error code you want to configure.
    5. Select URL and provide a physical URL to the error page (for example, /404.aspx). A physical URL is a URL without a domain name such as Default.aspx or 404.aspx.
    6. Click the OK button.

Verify that Custom Error Documents are Enabled - Plesk 11.x
  1. Log into the Plesk Control Panel.Select your domain.
  2. Click the Subscriptions tab, click your domain.
  3. Click the Websites & Domains tab.
  4. At the bottom of the page, click your domain again.
  5. Check the Custom error documents check box.
  6. Configure the custom error documents.
    1. Under the Websites & Domains tab, open Show Advanced Operations.
    2. Click Virtual Directories.
    3. Click on Error Documents.
    4. Click on the error code you want to configure.
    5. Select URL and provide a physical URL to the error page (for example, /404.aspx). A physical URL is a URL without a domain name such as Default.aspx or 404.aspx.
    6. Click the OK button.
Verify that Custom Error Documents are Enabled - Plesk 9.x
  1. Log into the Plesk Control Panel.
  2. Select your domain.
  3. Under the Website section click Webhosting Settings.
  4. Scroll down to the bottom and verify that Custom Error Pages are enabled - if they are not, check that box.
  5. Click the OK button.
  6. Configure the custom error documents.
    1. Under the Files section click Virtual Directories.
    2. Click on Error Documents.
    3. Click on the error code you want to configure.
    4. Select URL and provide a physical URL to the error page (for example, /404.aspx). A physical URL is a URL without a domain name such as /Default.aspx or /404.aspx.
    5. Click the OK button.
Configuring ASP.NET Error Pages
Warning: This is an advanced configuration that is provided for developers only. Technical assistance on this is not available.

Open up your web.config file and navigate to the customErrors section. Update your customErrors node to be similar to the following:
 
<customErrors mode="RemoteOnly"> <error statusCode="404" redirect="/404.aspx"/> </customErrors>
  • The statusCode node is the status code you want to trap. In this case, 404 is the status code for Page Not Found.
  • The redirect is the URL you want to send users to.  In this case, it is /404.aspx (assuming this URL exists).
Alternate Complete Solution
Warning: This is an advanced configuration that is provided for developers only. Technical assistance on this is not available.

This solution provides an easy fix that encompasses ALL errors.
Open up your web.config file and navigate to the CustomErrors section. Update your customErrors node to be similar to the following:
 
<customErrors mode="On" defaultRedirect="/GenericError.html" />

One thing to note, is that this method will encompass ALL of your errors. What this line does, is provides a generic document for any error that is not directly specified.
To specify a certain status code, you will need this line to be modified to look similar to the following:

 
<customErrors defaultRedirect="GenericError.html" mode="On"> <error statusCode="500" redirect="InternalError.htm" /> <error statusCode="http_error_code" redirect="/path_to_error_file" /> </customErrors>

 It is necessary to specify any error codes you would like to have custom documents, else a generic page will be given by the defaultRedirect attribute given to the customErrors element in the opening tag. A complete list of HTTP error status codes can be found here: w3schools.com/tags/ref_httpmessages

Add Feedback