Error Messages

Error Messages

The web sites web.config file and Global.asax file have been equipped to handle custom errors.  When an error occurs within the application the Global.asax determines if the error is an HTTP error and handles it accordingly.  This feature requires custom errors to be on in the web.config file.

If the current error is a 404 error and a 404 Redirect record exists with an Original URL value that matches the URL on which the error originated the user will be redirected to the URL entered in the Redirect To attribute.  The Redirect To URL cannot exist in any other record as the Original URL or the redirect will be blocked. The original URL must be root relative or fully qualified and directories should not contain a trailing slash (/).  This redirect only occurs if the page on which the error occurred is handled by the .NET framework.  To get other pages to support this feature you manually change the IIS settings for the site.  Under the Custom Errors tag the 404 HTTP Error must point to the URL '/Error.aspx'.

All HTTP errors that are not existing 404 Redirects are redirected to a page that finds the custom error message based on the current error.  If no message is found the default message will be displayed regardless of its enabled status or whether it is URL specific.  If this record does not contain a valid message a system message will be displayed.  URL specific error messages that exist for the current hostname will be displayed before general error messages, and may be formatted "*.yoursite.com" to use one error message for all versions of a hostname including "yoursite.com".  Pages that are not handled by the .NET framework may not report errors properly in IIS 6.  In this case change the Custom Error within IIS 6 to '/Error.aspx'.  This will cause IIS to send these errors to your custom error page.

We support custom error handling. You can enable this by navigating to module property and setting Custom Error Pre-Processor to yes. Chane the name of the method in Custom Method to your method name and create that method in your cp:scripting file. You can copy the template for CustomErrors which located in Root\App_Code\DevV\CpScripting.cs