asp.net - CompleteRequest in HTTPModule's OnError event -


I have installed an HTTPModule that, on an ASP.NET applications, to log an error in a database. However, what is happening to me is that if the exception is in the loop, then the page continues to execute (also logged with all the errors).

This is the code for an on-earer event of the HTTPModule:

  attib configuration error = attib configuration. GateConfig (); HttpContext ctx = HttpContext.Current; HTPRS response = CTX response; HttpRequest request = ctx.Request; // An error when stringbilder innerExceptionText = new StringBuilder (); Int i; String error message = string Empty; String Error StackTrace = string.Empty; String error: BaseMessage = string.Empty; String Error BaseStackTrace = string.Empty; String errorInretext = string Empty; Exception e = ctx.Server.GetLastError (); // Retrieve top-level exception information; In uncontrolled errors, this is usually an example of HTTPPNEnded Expression Class, in which all the information is included Error message = E. message; ErrorStackTrace = E. stack trace; // Recover the first exception. If only one exception has occurred, then this // method gives the exact same information top-level exception is ErrorBaseMessage = E. GetBaseException () message; ErrorBaseStackTrace = E. GetBaseException () StackTrace; // Dump all internal exceptions, and the session / query string variable information errorInretext = InnerXtext. Toasting (); // Clear the previous error ctx.Server.ClearError (); // Error in error log add int? ErrorNumber; // Passing into a database connection string, create a new instance of the error handling class. ErrorManager errorinst = New Error Manager (); Error entry error = new error operator (); Error.UserName = ctx.User.Identity.Name; Error. Application = "test application"; Error.BaseExceptionText = Error BaseMessage + Environment.NewLine + errorBaseStackTrace; Error.InnerExceptionText = errorInnerText; Error.ExceptionText = Error message + environment. NewLine + errorStackTrace; Error = errorinst.SaveError (ref error); ErrorNumber = error.ErrorID; // Automatic Redirection Response.AppendHeader ("Refresh", "5; url =" + Error home page); // Recover HTML from the resource: Error HTML String html = Properties. Resources. Error html; // Writing the HTML out to the response stream. Response.Write (HTML); Ctx.ApplicationInstance.CompleteRequest ();  

ApplicationInstance.CompleteRequest does not seem to fix the problem, and the response.end calls another exception, throws an exception to me, that's what I got in response. If I want to apply on any other page, it uses abortion right in the wrong way for the second parameter.

Any thoughts?


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -