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); }
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; }