Sunday, August 19, 2012

Custom error settings in application in asp.net

Microsoft is providing web pages towards errors.This web pages are called"built in error pages".It will provide a lot of technical information .The solution for this is Custom error page which means the error page is provided by developer .The main purpose of custom error page in providing user friendly message.
The custom errors can be handled in two ways
1.Page level:-
This requires settings with Page Directive
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" errorpage="custom error page" %>
In this when the error occurs format towards client request processing with the web page.The client will be redirected to custom error page
2.Application Level(Web site Level):-
This requires settings under web.config
<customErrors mode="On/Off/Remote only" default Redirect="Generic error page">
<errorStatus code="error number" redirect="custom error page"/>
</customErrors">
Modes:-
On-->Custom errors will be enable for local host client and remote client
Off-->Custom errors will be disabled
Remote Only-->Errors will be enabled only for remote clients.This option will useful for live sites only

No comments:

Bel