Monday, March 31, 2008

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
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;
err = objErr.Message.ToString().Replace(".aspx.cs", "ASPXCS").Replace(" ","b");// +"#" + objErr.StackTrace.ToString().Replace("\n", " ");
//EventLog.WriteEntry("Sample_WebApp", err, EventLogEntryType.Error);

// Response.Redirect("err.aspx?err="+err);

No comments: