Friday 1 February 2013

CustomError mode in web.config file


Create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File -->
 
<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

When customErrors is set to On or RemoteOnly, you need to specify the defaultRedirect attribute. This attribute contains the error page to which the user will be redirected. Additionally you can take custom error handling a step further by associating specific errors with specific error pages. The customErrors section can contain error elements that associate particular errors with error pages. The following code sample illustrates this concept.

<?xml version="1.0"?>
  <configuration>
     <system.web>
 <customErrors mode="RemoteOnly" defaultRedirect="Contents/CommonPage.aspx">
      <error statusCode="403" redirect="Contents/CommonPage.aspx" />
      <error statusCode="404" redirect="Contents/CommonPage.aspx" />
    </customErrors>
     </system.web>
  </configuratio

No comments:

Post a Comment

If any doubt?then please comment in my post

How to reduce angular CLI build time

 Index: ----- I am using angular cli - 7 and I am going to tell how to reduce the build time as per my knowledge. Problem: -------- Now the ...