Sunday, 30 December 2012 15:44

redirecting to custom error pages in application

Written by 
Rate this item
(0 votes)

in application there may be different
server errors like file not found,server error,
etc.when those errors happens default ASP.NET error
page is shown which looks odd and users don't
understand what type of errors overcome
these problems it's a good idea to use own
error files.

I always add the following settings
in my web.config file to show specific error
pages -

under <system.web> add -

<customErrors defaultRedirect="error.html" mode="On">
<error statusCode="500" redirect="server_error.html"/>
<error statusCode="403" redirect="error_noaccess.html"/>
<error statusCode="404" redirect="error_filenotfound.html"/>

There are 3 error modes on which ASP.NET application works:
Off Mode,On Mode,RemoteOnly Mode

here i used On mode to show specific error page according
to statusCode.if you use Off mode then default
error pages shown.

Read 2926 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.