CustomError Docs
CustomError is an IIS module that gives developers the ability to implement customized, site-specific HTTP error pages and redirection without intervention by an IIS administrator, allowing developers to:- follow a simple convention in naming their error files
- upload their error files to a designated directory under a given site's document root.
- centrally manage redirection on known errors from one simple rules file
- Getting Started with CustomError
- Installation
- Using the Settings Manager
- Log Viewer
- System Requirements
Getting Started with CustomError
CustomError's power is in its simplicity. The software's Error Directory is a directory at the root of each site (or any directory of the site, see Directory Tab) into which site developers can place their customized error pages.
The name of the directory is configured at installation time, but may also be changed for each site at any time.
When an HTTP error response is generated by the Web server, CustomError looks in the Error Directory and retrieves the appropriate error page. Error pages are named according to the following convention:
CustomError may also be configured to send an image file instead of an HTML file. For example, if the following request generates a 404 error:
The tool also provides a mechanism to manage file redirection from one convenient rules file - a nice alternative to remembering redirections in an ad hoc-fashion. Given the importance of managing dead or moved links to search engine optimization, this feature is very useful. CustomError has full error logging features, as well as an integrated error log file viewer. back to top
CustomError's power is in its simplicity. The software's Error Directory is a directory at the root of each site (or any directory of the site, see Directory Tab) into which site developers can place their customized error pages.
The name of the directory is configured at installation time, but may also be changed for each site at any time.
When an HTTP error response is generated by the Web server, CustomError looks in the Error Directory and retrieves the appropriate error page. Error pages are named according to the following convention:
Error-Code Dot File-Extension
For example, 403.htm or 403.html, 404.htm or 404.html, 500.htm or 500.html. Dynamic files like ASP can also be configured to deliver 404 error pages with CustomError.CustomError may also be configured to send an image file instead of an HTML file. For example, if the following request generates a 404 error:
/images/some-image.gif
CustomError could be configured to send back /errors/404.gif rather than /errors/404.html.The tool also provides a mechanism to manage file redirection from one convenient rules file - a nice alternative to remembering redirections in an ad hoc-fashion. Given the importance of managing dead or moved links to search engine optimization, this feature is very useful. CustomError has full error logging features, as well as an integrated error log file viewer. back to top
Installation
Installing CustomError is very simple. Once you have downloaded the installer executable from the Port80 Software Web site, double click on the file to begin the CustomError setup program.
The CustomError setup program will guide you through the steps necessary to complete the installation. You will be asked to accept the license agreement and to choose an installation destination. The default installation location is C:\Program Files\Port80\CustomError.
Installing CustomError is very simple. Once you have downloaded the installer executable from the Port80 Software Web site, double click on the file to begin the CustomError setup program.
The CustomError setup program will guide you through the steps necessary to complete the installation. You will be asked to accept the license agreement and to choose an installation destination. The default installation location is C:\Program Files\Port80\CustomError.
Files Installed by CustomError
CustomError installs the following files in the following default locations:
In C:\%SystemRoot%\System32\inetsrv\
In C:\Program Files\Port80\CustomError\
CustomError installs the following files in the following default locations:
In C:\%SystemRoot%\System32\inetsrv\
| ce_isapi.dll | CustomError ISAPI filter DLL |
| ce_ext.dll | CustomError extension for IIS MMC Snap-in |
| CustomError.exe | CustomError Settings Manager |
| ce_wizard.exe | CustomError Setup Wizard |
| ce_logviewer.exe | CustomError log file viewer |
| w3svcupd.exe | Installer utility for updating metabase |
| Activation.txt | CustomError activation informational file |
| Documentation.htm | CustomError HTML Documentation |
| ReleaseHistory.htm | CustomError Release History |
| TipsAndHints.htm | Tips and Hints on how to use CustomError |
| TechSupport.htm | Shortcut to online technical support |
| Files (directory) | Supporting files for Documentation.htm, ReleaseHistory.htm, and TipsAndHints.htm |
| Templates (directory) | CustomError error file and rules file templates |
Using the Settings Manager
The CustomError Settings Manager can be launched from the Port80/CustomError program group in the Start menu, or directly by running CustomError.exe. The Settings Manager controls the operation of CustomError for any Web site (virtual server) provisioned on the computer. On the left side of the Settings Manager is a list of all the Web Sites (virtual servers) that are available on the computer. Use this list to select the Web site whose settings you want to change.
![Screenshot of CustomError Settings Manager [Screenshot]](/assets/images/docs_ce_dlg.gif)
The CustomError Settings Manager can be launched from the Port80/CustomError program group in the Start menu, or directly by running CustomError.exe. The Settings Manager controls the operation of CustomError for any Web site (virtual server) provisioned on the computer. On the left side of the Settings Manager is a list of all the Web Sites (virtual servers) that are available on the computer. Use this list to select the Web site whose settings you want to change.
![Screenshot of CustomError Settings Manager [Screenshot]](/assets/images/docs_ce_dlg.gif)
- To configure CustomError settings for a particular Web site: Select the site from the Web Sites list. The controls on the Settings Manager will reflect the current settings for that Web site. Any changes you make will take effect only for the site that is selected.
- To configure CustomError's default settings for new Web sites: Select Default Settings from the Web Sites list. The controls on the Settings Manager will reflect the current default settings. Any changes you make will take effect for any new Web sites that are added in IIS.
- To configure CustomError settings for two or more Web sites: Select the sites from the Web Sites list (optionally including Default Settings) using the Shift key (for two or more contiguous Web sites) or the Control key (for two or more discontinuous Web sites). In this case, the controls on the Settings Manager will reflect the current settings for the first Web site selected -- which will also be the one pointed to by the arrow indicator. Any changes you make will take effect for all the sites that are selected.
Error Directory Tab
![Screenshot of CustomError Error Directory Tab [Screenshot]](/assets/images/docs_ce_dlg1.gif)
Error Directory Name
The name of the directory in which error files are to be placed. The default directory name is "errors".
Error Directory Search Mode
This setting determines how to find the Error Directory.
Selecting "Check Site Root..." means that CustomError will only look for the Error Directory in the root of the Web site. For example, if C:\www\site1 was the root of the Web site and the CustomError directory was configured to be "MyErrors", then CustomError would look in C:\www\site1\MyErrors for the appropriate Error File.
Selecting "Check Requested Directory..." means that CustomError will begin searching for the Error Directory within the same directory as the requested file, and then look to the next highest level directory in the request URL, and so on, until an Error Directory is found.
Regardless of which method is selected, if an appropriately-named Error Directory or an appropriately-named Error File are not found, the error is simply handled by Microsoft IIS as if CustomError were not present.
![Screenshot of CustomError Error Directory Tab [Screenshot]](/assets/images/docs_ce_dlg1.gif)
Error Directory Name
The name of the directory in which error files are to be placed. The default directory name is "errors".
Error Directory Search Mode
This setting determines how to find the Error Directory.
Selecting "Check Site Root..." means that CustomError will only look for the Error Directory in the root of the Web site. For example, if C:\www\site1 was the root of the Web site and the CustomError directory was configured to be "MyErrors", then CustomError would look in C:\www\site1\MyErrors for the appropriate Error File.
Selecting "Check Requested Directory..." means that CustomError will begin searching for the Error Directory within the same directory as the requested file, and then look to the next highest level directory in the request URL, and so on, until an Error Directory is found.
Regardless of which method is selected, if an appropriately-named Error Directory or an appropriately-named Error File are not found, the error is simply handled by Microsoft IIS as if CustomError were not present.
Error Files Tab
![Screenshot of CustomError Error Files Tab [Screenshot]](/assets/images/docs_ce_dlg2.gif)
Static Error Pages
This file extension list configures the order in which CustomError searches for the Error File. The default order is (1) .htm, (2) .html. For example, if a 405 error occurs, CustomError would look for 405.htm, then if that file does not exist, proceed to look for 405.html.
Enable Dynamic 404 Pages
This setting enables CustomError to allow dynamic error pages for 404 errors. The file extension list associated with this setting configures the order in which CustomError searches for the Error File. The default order is (1) .asp, (2) .aspx. For example, if this setting is enabled and a 404 error occurs, CustomError would look for 404.asp, and then if that file does not exist, proceed to look for 404.aspx.
Enable 404 Images
This setting enables CustomError to send an error image rather than an HTML file when a 404 error occurs.
CustomError determines when to send an error image by the Request Wildcards tab. If the request that causes a 404 error matches any of these wildcards, then CustomError will send an error image (if one exists). For example, the first default wildcard is "/images/*". This means that any request (resulting in a 404) whose path starts with /images/ will be considered an image request.
The file extension list on the File Extension tab, configures the order in which CustomError looks for an error image with the specified file extension. The file extension of the error image does not need to be the same as the file extension of the requested image.
![Screenshot of CustomError Error Files Tab [Screenshot]](/assets/images/docs_ce_dlg2.gif)
Static Error PagesThis file extension list configures the order in which CustomError searches for the Error File. The default order is (1) .htm, (2) .html. For example, if a 405 error occurs, CustomError would look for 405.htm, then if that file does not exist, proceed to look for 405.html.
Enable Dynamic 404 PagesThis setting enables CustomError to allow dynamic error pages for 404 errors. The file extension list associated with this setting configures the order in which CustomError searches for the Error File. The default order is (1) .asp, (2) .aspx. For example, if this setting is enabled and a 404 error occurs, CustomError would look for 404.asp, and then if that file does not exist, proceed to look for 404.aspx.
Enable 404 ImagesThis setting enables CustomError to send an error image rather than an HTML file when a 404 error occurs.
CustomError determines when to send an error image by the Request Wildcards tab. If the request that causes a 404 error matches any of these wildcards, then CustomError will send an error image (if one exists). For example, the first default wildcard is "/images/*". This means that any request (resulting in a 404) whose path starts with /images/ will be considered an image request.
The file extension list on the File Extension tab, configures the order in which CustomError looks for an error image with the specified file extension. The file extension of the error image does not need to be the same as the file extension of the requested image.
Redirection Rules Tab
![Screenshot of CustomError Logging Tab [Screenshot]](/assets/images/docs_ce_dlg3.gif)
![Screenshot of CustomError Logging Tab [Screenshot]](/assets/images/docs_ce_dlg3.gif)
A unique feature of CustomError is its centrally located, rule-based redirection file, rules.ce, which should be located at the root of the Web site. The file can contain simple rules that CustomError will use to send a redirection response (rather than the usual HTML response) when a 404 error occurs.
The syntax is simple:
The Redirection-URL is the URL that CustomError will put in the Location: header of the redirection response. You can enter the fully qualified URL (i.e. http://www.port80software.com/products/index.htm) or just the path portion (i.e. /products/index.htm). The rules file also allows for special variables to be used in the Redirection-URL, which CustomError will replace with the actual values.
For example:
This allows you to do your own logging and/or handling of errors that occur on your site.
The Redirection-Type determines the type of HTTP redirect used in the error response and is optional. The possible values are:
The syntax is simple:
Request-Wildcard Tab Redirection-URL [Tab Redirection-Type]
The Request-Wildcard should reflect the path portion of the request; an asterisk (*) may be used as a wild card. For example, a Request-Wildcard with this value:
/products/mypage.htm
would only match a request for the file /products/mypage.htm. However, if the Request-Wildcard was:
*/mypage.htm
it would match all of the following:
/mypage.htm
/products/mypage.htm
/foo/bar/mypage.htm
/products/mypage.htm
/foo/bar/mypage.htm
The Redirection-URL is the URL that CustomError will put in the Location: header of the redirection response. You can enter the fully qualified URL (i.e. http://www.port80software.com/products/index.htm) or just the path portion (i.e. /products/index.htm). The rules file also allows for special variables to be used in the Redirection-URL, which CustomError will replace with the actual values.
$U - The full request URL, including the query string.
$P - The path portion of the request URL.
$Q - The query string portion of the request URL.
$R - The contents of the HTTP Referer header from the original request.
$P - The path portion of the request URL.
$Q - The query string portion of the request URL.
$R - The contents of the HTTP Referer header from the original request.
For example:
| Request URL: | /dir/mypage.asp?var1=value1 |
| Redirection-URL Rule: | /dir/* /MyErrorHandler.asp?path=$P&query=$Q |
| Redirection URL: | /MyErrorHandler.asp? path=%dir%2Fmypage%2Easp&query=var1%value1 |
The Redirection-Type determines the type of HTTP redirect used in the error response and is optional. The possible values are:
"302" or "temp" for a temporary redirect ("302 Found", see RFC 2616).
"301" or "perm" for a permanent redirect ("301 Moved Permanently", see RFC 2616).
If the Redirection-Type is not included in the rule, the default is a 302 redirect.
"301" or "perm" for a permanent redirect ("301 Moved Permanently", see RFC 2616).
Note: Please use caution with this feature.
If you had the following rule set up:
and /some-file.htm generated an error, you would have infinite redirection because CustomError would redirect to a file that would cause another error.
If you had the following rule set up:
/some-file.htm /some-file.htm
Logging Tab
![Screenshot of CustomError Logging Tab [Screenshot]](/assets/images/docs_ce_dlg4.gif)
![Screenshot of CustomError Logging Tab [Screenshot]](/assets/images/docs_ce_dlg4.gif)
This tab allows you to enable logging for CustomError. When enabled, CustomError will log information about requests in which it acts upon. The log files are created in the directory specified. If you enter [SITE] into the path when you have "Default Settings" or multiple sites selected, the Settings Manager will automatically insert the Microsoft IIS virtual server site number into the path. For example, if you were to select "All Web Sites" and enter
back to top C:\Logs\CustomError\W3SVC[SITE]\
CustomError would create these directories:
C:\Logs\CustomError\W3SVC1\
C:\Logs\CustomError\W3SVC2\
...
and so on, for each site selected.C:\Logs\CustomError\W3SVC2\
...
Log Viewer
![Screenshot of CustomError Log Viewer [Screenshot]](/assets/images/docs_ce_log.gif)
The CustomError Log Viewer is a utility to easily view the CustomError log files. Use the "Virtual Server List" to choose a Web site whose log files you would like to view. Once you have chosen a Web site, use the "Log Files" list to choose a log file to view.
back to top
![Screenshot of CustomError Log Viewer [Screenshot]](/assets/images/docs_ce_log.gif)
The CustomError Log Viewer is a utility to easily view the CustomError log files. Use the "Virtual Server List" to choose a Web site whose log files you would like to view. Once you have chosen a Web site, use the "Log Files" list to choose a log file to view.
back to top
System Requirements
CustomError is compatible with the following:
CustomError is compatible with the following:
- IIS 6.0 (Windows Server 2003)
- IIS 5.0 (Windows 2000 Server)
- IIS 4.0 (NT 4.0 Server)
- IIS 5.1 (Windows XP)*
* Since Windows XP lacks a true "server" configuration, Port80 Software neither recommends nor supports the use of its software on Windows XP (and the associated version of IIS) in production environments. The Windows XP environment is supported exclusively as an evaluation platform.
back to top 