Customizing the 404-error pages

This how-to contains information about specifying custom error pages when hosting a Dynamicweb solution.

Dynamicweb lets you specify a custom error page for "Page cannot be displayed" errors (HTTP 404 Error).

Redirection of the HTTP 404 error page is handled in part by the webserver IIS and in part by the Dynamicweb webpage /Admin/Public/404.aspx.

So to set custom error pages, you must:

  • Customize the IIS error page settings
  • Customize your Dynamicweb error page settings

To set the IIS custom error page:

  • Start the IIS Manager on the server with your Dynamicweb website and locate your website.
  • Select the website.
  • Select the Error Pages settings in the IIS Section not the one in ASP.NET section (Figure 2.1)
Figure 2.1 Select the IIS Error Pages settings
  • Click on 404, and choose Edit from the Actions pane in the right side of the IIS manager. This opens the edit page (Figure 2.2).
Figure 2.2 Edit the error page settings in this window
  • Fill in the following fields:
    • Response Action
      Execute a URL on this site.
    • URL (relative to site root)
      Enter /Admin/Public/404.aspx.
  • Click OK in Properties windows to save your changes, completing the procedure.

Once the IIS has been set up, you can customize your Dynamicweb solution to display either a page on your website or an HTML file from the file archive instead of the standard HTTP 404 error page.

To customize the Dynamicweb error page for your solution:

  • Go to Settings > System > Solution settings (Figure 3.1)
  • Enter your custom error page in the Custom error page -> HTTP 404 field
  • Save your changes

If you want to set website-specific error pages, edit the website properties (Apps > Websites > Your website) and specify your custom error page in the HTTP 404 field (Figure 3.2).

Figure 3.2 Website-specific error pages are set in the website properties