Exemplo n.º 1
0
        public static string DealException(Exception ex, bool writeLog)
        {
            if (ex == null)
            {
                return("unknown");
            }
            var msg = "unknown";

            if (ex is HttpException)
            {
                int code = (ex as HttpException).GetHttpCode();
                if (code != 500)
                {
                    writeLog = false;
                }
                if (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }
                msg = code.ToString();
            }
            if (ex is HttpRequestValidationException)
            {
                ex  = new XSSException(GetClientIP(HttpContext.Current), ex);
                msg = "xss";
            }
            if (writeLog)
            {
                DbLog.Append(ex);
            }
            return(msg);
        }
Exemplo n.º 2
0
 public static string DealException(Exception ex, bool writeLog)
 {
     if (ex == null)
         return "unknown";
     var msg = "unknown";
     if (ex is HttpException)
     {
         int code = (ex as HttpException).GetHttpCode();
         if (code != 500)
             writeLog = false;
         if (ex.InnerException != null)
             ex = ex.InnerException;
         msg = code.ToString();
     }
     if (ex is HttpRequestValidationException)
     {
         ex = new XSSException(GetClientIP(HttpContext.Current), ex);
         msg = "xss";
     }
     if (writeLog)
         DbLog.Append(ex);
     return msg;
 }