Friday, April 23, 2010

Handle Custom Error

Page Level

User errorPage attribute from the form.

Example:-

<%@ Page language="c#" Codebehind="ProductPnl.aspx.cs" 
    AutoEventWireup="false" Inherits=" ProductPnl " 
    errorPage="ErrorPages/PageError.aspx"%>
 
 Web.Config   


 Application_Error procedure in Global.asax
 
 
void Application_Error(object sender, EventArgs e)

{
Exception CurrentException = Server.GetLastError();
Server.ClearError();
Response.Clear();Response.Write("Error message: "+ CurrentException.Message + "");
Response.Write("Error details:");
Response.Write(CurrentException.ToString());
}



0 comments:

Post a Comment