Monday, March 31, 2008

http://errohandling.blogspot.com

http://errohandling.blogspot.com

Thsi Block of Code uses in following condition

When we Required to Redired on Error page whenever any unhandled error comes
and we need the technical specsification .
2) with the same place we can import namesapce for sending mail and send mail on same
sting.
this name space is must add
<%@ Import Namespace="System.Diagnostics" %>



void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string err = string.Empty;
//Request.Url.ToString().Replace(".aspx","_ASPX");
err = objErr.Message.ToString().Replace(".aspx.cs", "ASPXCS").Replace(" ","b");// +"#" + objErr.StackTrace.ToString().Replace("\n", " ");
//EventLog.WriteEntry("Sample_WebApp", err, EventLogEntryType.Error);

HttpContext.Current.Session["err"];
// Response.Redirect("err.aspx?err="+err);
Server.ClearError();
}

No comments: