Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model Models.Error.ErrorPageModel
- <div class="alert">
- <p class="">
- <strong>Error</strong>
- </p>
- </div>
- public ActionResult Index()
- {
- ErrorPageModel model = new ErrorPageModel();
- return View("Error",model);
- }
- if (currentRouteData != null)
- {
- if (currentRouteData.Values["controller"] != null && !string.IsNullOrEmpty(currentRouteData.Values["controller"].ToString()))
- {
- currentController = currentRouteData.Values["controller"].ToString();
- }
- if (currentRouteData.Values["action"] != null && !string.IsNullOrEmpty(currentRouteData.Values["action"].ToString()))
- {
- currentAction = currentRouteData.Values["action"].ToString();
- }
- }
- httpContext.ClearError();
- httpContext.Response.Clear();
- httpContext.Response.StatusCode = exception is HttpException ? ((HttpException)exception).GetHttpCode() : 500;
- httpContext.Response.TrySkipIisCustomErrors = true;
- httpContext.Response.ContentType = "text/html";
- ErrorController controller = new ErrorController();
- RouteData routeData = new RouteData();
- routeData.Values["controller"] = "Error";
- routeData.Values["action"] = "Index";
- controller.ViewData.Model = new ErrorPageModel();
- ((IController)controller).Execute(new RequestContext(new HttpContextWrapper(httpContext), routeData));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement