top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the use of customErrors tag in web.config file ?

+1 vote
437 views
What is the use of customErrors tag in web.config file ?
posted Dec 3, 2014 by Roshan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

CustomErrors tag provides information about custom error messages for an ASP.NET application. The customErrors element can be defined at any level in the application file hierarchy.
Code:

<customErrors defaultRedirect ="Error.aspx" mode ="Off">
   <error statusCode ="401" redirect ="Unauthorized.aspx"/>

</customErrors>

The customErrors section consists of defaultRedirect and mode attributes which specify the default redirect page and the on/off mode respectively.
The subsection of customErrors section allows redirecting to specified page depending on the error status code.

400 Bad Request
401 Unauthorized
404 Not Found
408 Request Timeout
answer Dec 3, 2014 by Manikandan J
...