private void ExecuteErrorPage() { ErrorInfo errorInfo = new ErrorInfo(httpStatusCode, this.exception, HttpContext.Current.Request); RouteData routeData = new RouteData(); routeData.Values.Add("controller", this.config.ErrorControllerName); routeData.Values.Add("action", this.config.ErrorActionName); routeData.Values.Add("errorInfo", errorInfo); HttpContextWrapper httpContextWrapper = new HttpContextWrapper(HttpContext.Current); RequestContext requestContext = new RequestContext(httpContextWrapper, routeData); IControllerFactory controllerFactory = ControllerBuilder.Current.GetControllerFactory(); IController errorController = controllerFactory.CreateController(requestContext, this.config.ErrorControllerName); errorController.Execute(requestContext); if (httpStatusCode > 0) { HttpContext.Current.Response.StatusCode = httpStatusCode; HttpContext.Current.Response.ContentType = "text/html"; } HttpContext.Current.Response.TrySkipIisCustomErrors = true; }
public ActionResult Error(ErrorInfo errorInfo) { return View("Error" + errorInfo.HttpStatusCode, errorInfo); }