Beispiel #1
0
        private static void LogHttpParseException(HttpParseException ex, HttpContext context, RouteData routeData, BaseController controller)
        {
            int httpCode = ex.GetHttpCode();
            string message = string.Empty;

            message = "Http Parse Exception " + httpCode
                + "  \n-Message: " + ex.Message
                + "  \n-Source: " + ex.Source
                + "  \n-VirtualPath: " + ex.VirtualPath
                + "  \n-FileName: " + ex.FileName + " (" + ex.Line + ")"
                + "  \n-Parser Error Count: " + ex.ParserErrors.Count;

            int counter = 0;
            foreach (ParserError item in ex.ParserErrors)
            {
                counter++;
                string errorText = item.VirtualPath + " (" + item.Line + ") " + item.ErrorText;
                message += "  \n-Parser Error [" + counter + "]: " + errorText;
            }

            message += "  \n-Parser Errors: " + ex.ParserErrors.ToString()
                + "  \n-WebEventCode: " + ex.WebEventCode
                + "  \n-ErrorCode: " + ex.ErrorCode
                + "  \n-TargetSiteName: " + ex.TargetSite.Name
                + "  \n-StackTrace: " + ex.StackTrace
                + " Html Message: " + ex.GetHtmlErrorMessage();

            LogException(message, ex, Models.SystemEventLevel.Error, context, routeData, controller);
        }
Beispiel #2
0
 public static bool HandleHttpParseException(HttpParseException ex, bool clearError, HttpContext context, RouteData routeData, BaseController controller)
 {
     string rawUrl = context.Request.RawUrl;
     string url = context.Request.Url.ToString();
     if (Settings.AppLogSystemEventsToDb || Settings.AppLogSystemEventsToFile)
     {
         LogHttpParseException(ex, context, routeData, controller);
     }
     if (Settings.AppUseFriendlyErrorPages)
     {
         ShowErrorPage(ErrorPage.Error_HttpError, ex.GetHttpCode(), ex, clearError, context, controller);
         return true;
     }
     return false;
 }