/* * Return the formatter associated with this exception */ internal static ErrorFormatter GetErrorFormatter(Exception e) { Exception inner = e.InnerException; ErrorFormatter nestedFormatter = null; // First, see if the inner exception has a formatter if (inner != null) { nestedFormatter = GetErrorFormatter(inner); if (nestedFormatter != null) { return(nestedFormatter); } if (inner is ConfigurationException) { ConfigurationException ce = inner as ConfigurationException; if (ce != null && ce.Filename != null) { nestedFormatter = new ConfigErrorFormatter((ConfigurationException)inner); } } else if (inner is SecurityException) { nestedFormatter = new SecurityErrorFormatter(inner); } } // If it does, return it rather than our own if (nestedFormatter != null) { return(nestedFormatter); } HttpException httpExc = e as HttpException; if (httpExc != null) { return(httpExc._errorFormatter); } return(null); }
internal static ErrorFormatter GetErrorFormatter(Exception e) { Exception innerException = e.InnerException; ErrorFormatter errorFormatter = null; if (innerException != null) { errorFormatter = GetErrorFormatter(innerException); if (errorFormatter != null) { return(errorFormatter); } if (innerException is ConfigurationException) { ConfigurationException exception2 = innerException as ConfigurationException; if ((exception2 != null) && (exception2.Filename != null)) { errorFormatter = new ConfigErrorFormatter((ConfigurationException)innerException); } } else if (innerException is SecurityException) { errorFormatter = new SecurityErrorFormatter(innerException); } } if (errorFormatter != null) { return(errorFormatter); } HttpException exception3 = e as HttpException; if (exception3 != null) { return(exception3._errorFormatter); } return(null); }
/* * Return the formatter associated with this exception */ internal static ErrorFormatter GetErrorFormatter(Exception e) { Exception inner = e.InnerException; ErrorFormatter nestedFormatter = null; // First, see if the inner exception has a formatter if (inner != null) { nestedFormatter = GetErrorFormatter(inner); if (nestedFormatter != null) return nestedFormatter; if (inner is ConfigurationException) { ConfigurationException ce = inner as ConfigurationException; if (ce != null && ce.Filename != null) nestedFormatter = new ConfigErrorFormatter((ConfigurationException)inner); } else if (inner is SecurityException) nestedFormatter = new SecurityErrorFormatter(inner); } // If it does, return it rather than our own if (nestedFormatter != null) return nestedFormatter; HttpException httpExc = e as HttpException; if (httpExc != null) return httpExc._errorFormatter; return null; }
internal ErrorFormatter GetErrorFormatter(Exception e) { ErrorFormatter errorFormatter = null; if (_overrideErrorFormatter != null) { return _overrideErrorFormatter; } // Try to get an error formatter errorFormatter = HttpException.GetErrorFormatter(e); if (errorFormatter == null) { ConfigurationException ce = e as ConfigurationException; if (ce != null && !String.IsNullOrEmpty(ce.Filename)) errorFormatter = new ConfigErrorFormatter(ce); } // If we couldn't get one, create one here if (errorFormatter == null) { // If it's a 404, use a special error page, otherwise, use a more // generic one. if (_statusCode == 404) errorFormatter = new PageNotFoundErrorFormatter(Request.Path); else if (_statusCode == 403) errorFormatter = new PageForbiddenErrorFormatter(Request.Path); else { if (e is System.Security.SecurityException) errorFormatter = new SecurityErrorFormatter(e); else errorFormatter = new UnhandledErrorFormatter(e); } } return errorFormatter; }
internal static ErrorFormatter GetErrorFormatter(Exception e) { Exception innerException = e.InnerException; ErrorFormatter errorFormatter = null; if (innerException != null) { errorFormatter = GetErrorFormatter(innerException); if (errorFormatter != null) { return errorFormatter; } if (innerException is ConfigurationException) { ConfigurationException exception2 = innerException as ConfigurationException; if ((exception2 != null) && (exception2.Filename != null)) { errorFormatter = new ConfigErrorFormatter((ConfigurationException) innerException); } } else if (innerException is SecurityException) { errorFormatter = new SecurityErrorFormatter(innerException); } } if (errorFormatter != null) { return errorFormatter; } HttpException exception3 = e as HttpException; if (exception3 != null) { return exception3._errorFormatter; } return null; }
internal ErrorFormatter GetErrorFormatter(Exception e) { ErrorFormatter errorFormatter = null; if (_overrideErrorFormatter != null) { return _overrideErrorFormatter; } // Try to get an error formatter errorFormatter = HttpException.GetErrorFormatter(e); if (errorFormatter == null) { ConfigurationException ce = e as ConfigurationException; if (ce != null && !String.IsNullOrEmpty(ce.Filename)) errorFormatter = new ConfigErrorFormatter(ce); } // If we couldn't get one, create one here if (errorFormatter == null) { // If it's a 404, use a special error page, otherwise, use a more // generic one. if (_statusCode == 404) errorFormatter = new PageNotFoundErrorFormatter(Request.Path); else if (_statusCode == 403) errorFormatter = new PageForbiddenErrorFormatter(Request.Path); else { if (e is System.Security.SecurityException) errorFormatter = new SecurityErrorFormatter(e); else errorFormatter = new UnhandledErrorFormatter(e); } } // Show config source only on local request for security reasons // Config file snippet may unintentionally reveal sensitive information (not related to the error) ConfigErrorFormatter configErrorFormatter = errorFormatter as ConfigErrorFormatter; if (configErrorFormatter != null) { configErrorFormatter.AllowSourceCode = Request.IsLocal; } return errorFormatter; }