<customErrors> Web.config section
The <customErrors> section of the Web.config file defines the settings for handling web application errors.
Below is the general syntax of this section:
<customErrors defaultRedirect="YourDefaultURL" mode="On|Off|RemoteOnly">
<error statusCode="ErrorStatusCode" redirect="YourRedirectURL"/>
</customErrors>
The attribute mode defines how custom error handling works and can be one of the following 3 options:
On: Enabled
Off: Disabled
RemoteOnly: Enabled only for remote clients (requests coming from the local machine are not handled by these custom error settings).
You can use the <customErrors> Web.config section to define how to handle particular error codes.
Here is an example of custom handling of 404 error (File Not Found):
<customErrors mode="On">
<error statusCode="404" redirect="Nice-FileNotFound-Page.aspx"/>
</customErrors>