コード例 #1
0
        private ActionResult GenerateNonAjaxResult(ExceptionContext filterContext)
        {
            filterContext.CheckNotNull("filterContext");
            string          controllerName = (string)filterContext.RouteData.Values["controller"];
            string          actionName     = (string)filterContext.RouteData.Values["action"];
            HandleErrorInfo model          = new HandleErrorInfo(filterContext.Exception, controllerName, actionName);
            var             result         = new ViewResult
            {
                ViewName   = this.View,
                MasterName = this.Master,
                ViewData   = new ViewDataDictionary <HandleErrorInfo>(model),
                TempData   = filterContext.Controller.TempData
            };

            filterContext.Result           = result;
            filterContext.ExceptionHandled = true;
            filterContext.HttpContext.Response.Clear();
            filterContext.HttpContext.Response.StatusCode             = 500;
            filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
            return(result);
        }