Monday 29 August 2016

Error Tracking on Asp.Net Page

 
[DllImport("iphlpapi.dll", ExactSpelling = true)]
 
public static extern int SendARP(int DestIP, int SrcIP, byte[] pMacAddr, ref uint PhyAddrLen);
 
protected override void OnError(EventArgs e)
{
StringBuilder ErrString = new StringBuilder();
HttpContext ctx = HttpContext.Current;
Exception exception = ctx.Server.GetLastError();
string Error_Message = exception.Message.ToString();
string Source = exception.Source.ToString();
string Error_Trace = exception.StackTrace.ToString();
string Error_Path = ctx.Request.Url.ToString();
string User_Name = User.Identity.Name;
string IP = Request.ServerVariables["REMOTE_HOST"];
string Mac_Address = Request.ServerVariables["REMOTE_HOST"];
Response.Redirect("Error.aspx");
ctx.Server.ClearError();
base.OnError(e);
}

No comments :