Beispiel #1
0
        protected void Application_Error(object sender, EventArgs e)
        {
            //http://stackoverflow.com/questions/2416182/garbled-error-page-output-using-gzip-in-asp-net-iis7
            HttpApplication app    = sender as HttpApplication;
            var             filter = app.Response.Filter;

            app.Response.Filter = null;

            // Get the exception object.
            Exception exc = Server.GetLastError();

            // Handle HTTP errors
            if (exc.GetType() == typeof(HttpException))
            {
                if (exc.Message.Contains("NoCatch") || exc.Message.Contains("maxUrlLength"))
                {
                    return;
                }
            }

            AuditLogManager.ReportWebException(Server, AuditEventType.SystemErrorAPI);

            Server.ClearError();
            Response.StatusCode = 500;

            HttpContext.Current.Response.Flush();                      // Sends all currently buffered output to the client.
            HttpContext.Current.Response.SuppressContent = true;       // Gets or sets a value indicating whether to send HTTP content to the client.
            HttpContext.Current.ApplicationInstance.CompleteRequest(); // Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event.
        }
Beispiel #2
0
        protected void Application_Error(object sender, EventArgs e)
        {
            //http://stackoverflow.com/questions/2416182/garbled-error-page-output-using-gzip-in-asp-net-iis7
            HttpApplication app = sender as HttpApplication;

            app.Response.Filter = null;


            // Get the exception object.
            Exception exc = Server.GetLastError();

            // Handle HTTP errors
            if (exc.GetType() == typeof(HttpException))
            {
                if (exc.Message.Contains("NoCatch") || exc.Message.Contains("maxUrlLength"))
                {
                    return;
                }
            }

            AuditLogManager.ReportWebException(Server, AuditEventType.SystemErrorAPI);

            Server.ClearError();
            Response.StatusCode = 500;
            Response.End();
        }
Beispiel #3
0
        protected void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs

            // Get the exception object.
            Exception exc = Server.GetLastError();

            // Handle HTTP errors
            if (exc.GetType() == typeof(HttpException) || exc.GetType() == typeof(System.Runtime.Serialization.SerializationException))
            {
                if (exc.Message.Contains("NoCatch") || exc.Message.Contains("maxUrlLength") || exc.Message.Contains("InMemoryTokenManager") || exc.Message.Contains("non-serializable") || exc.Message.Contains("The controller for path"))
                {
                    return;
                }
            }

            AuditLogManager.ReportWebException(Server, AuditEventType.SystemErrorWeb);

            Server.ClearError();
            Response.RedirectToRoute(new { controller = "Home", action = "GeneralError" });
        }