web.config: Set default error page Asp.net


Set default error page Asp.net

In this article i am going to share that how to set the default error page for your website . Every web application should have a custom error page. It provides a more professional-looking alternative to the Runtime Error .

Change the following line of code in your Web.Config  file.



 <configuration>
 <system.web>
 <customErrors mode="Off" defaultRedirect="Error.aspx" />
 </system.web>
 </configuration>



The <customErrors> section in Web.config has two attributes defaultRedirect and mode.

defaultRedirect :- It indicate the url of the error page.
mode :-it accepts three values On,Off,RemoteOnly.

Replace Error.aspx with the name of your  Error page name.
Tags: ,

Join Us!