This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = HttpContext.Current.Request.Path; | |
HttpContext.Current.RewritePath("~/Error/ManualErrors"); | |
HttpContext.Current.Session["statusCode"] = statusCode; | |
IHttpHandler handler = new MvcHttpHandler(); | |
handler.ProcessRequest(HttpContext.Current); | |
HttpContext.Current.RewritePath(path); | |
HttpContext.Current.Server.ClearError(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpContext.Current.Session["exception"] = exception; | |
var url = "~/Error/ManualErrors?statusCode=" + statusCode; | |
HttpContext.Current.Server.TransferRequest(url, false, "GET", null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var routeData = new RouteData(); | |
routeData.Values.Add("controller", ErrorControllerRouteName); | |
routeData.Values.Add("action", actionName); | |
var requestContext = new RequestContext( | |
new HttpContextWrapper(HttpContext.Current), | |
routeData); | |
var controllerFactory = ControllerBuilder.Current.GetControllerFactory(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var viewResult = new ViewResult {ViewName = "ManualErrors"}; | |
// Setting of values on its ViewBag here. | |
viewResult.ExecuteResult(controllerContext); | |
HttpContext.Current.Server.ClearError(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var routeData = new RouteData(); | |
routeData.Values.Add("controller", ErrorControllerRouteName); | |
var controllerContext = new ControllerContext( | |
new HttpContextWrapper(HttpContext.Current), | |
routeData, | |
new FakeController()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpContext.Current.Response.ClearHeaders(); | |
HttpContext.Current.Response.ClearContent(); | |
HttpContext.Current.Response.StatusCode = statusCode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpContext.Current.Server.ClearError(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var httpException = exception as HttpException; | |
... | |
var statusCode = httpException.GetHttpCode(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var exception = HttpContext.Current.Server.GetLastError(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.web> | |
<!-- Additional configuration elided. --> | |
<httpModules> | |
<add | |
name="ErrorHandlerHttpModule" | |
type="MvcErrorHandling.MvcHelpers.ErrorHandlerHttpModule, MvcErrorHandling" /> | |
</httpModules> | |
</system.web> | |
<system.webServer> |