Posted on: 9/15/2014 2:21:27 AM | Views : 443

Hi.
I need a code that writes a text file with the last error. Something like: 
protected void Application_Error(object sender, EventArgs e) { if (Thread.CurrentPrincipal is CirsaPrincipal) { HttpContext ctx = HttpContext.Current; StringBuilder sb = new StringBuilder(); CirsaLogger.WriteInfo("--------------------------- ERROR NO MANEJADO --------------------------"); sb.Append("USERID: " + ((CirsaPrincipal)Thread.CurrentPrincipal).Id.ToString()); sb.Append(System.Environment.NewLine + ctx.Request.Url.ToString()); sb.Append(System.Environment.NewLine + "Source:" + ctx.Server.GetLastError().Source.ToString()); sb.Append(System.Environment.NewLine + "Message:" + ctx.Server.GetLastError().Message.ToString()); sb.Append(System.Environment.NewLine + "Stack Trace:" + ctx.Server.GetLastError().StackTrace.ToString()); CirsaLogger.WriteInfo(sb.ToString()) ...

Go to the complete details ...