示例#1
0
        protected void Application_Error(object sender, System.EventArgs e)
        {
            // custom logger
            IErrorLogger errorLogger = new CustomLogger();

            // config of error handler
            MvcExceptionHandlerConfig config = new MvcExceptionHandlerConfig("Error", "Error", 404, 500);

            // init and handle
            new MvcExceptionHandler.MvcExceptionHandler(errorLogger, config).Handle();
        }
        public MvcExceptionHandler(IErrorLogger errorLogger, MvcExceptionHandlerConfig config = null)
        {
            if (config == null)
            {
                config = new MvcExceptionHandlerConfig();
            }

            this.errorLogger = errorLogger;
            this.config = config;
            this.exception = HttpContext.Current.Server.GetLastError();

            ExtractExceptionData();
        }