1. <customErrors mode="Off" /> (off - Everyone gets to see your errors guts, On - Everyone gets the Nice error page. remoteonly - only those local to the code get to see the errors guts)
2. Global error handling => false (EPiServers handling of this is problematic. <applicationSettings globalErrorHandling="Off")
3. Set route -> routes.MapRoute("Error_404", "notfound", new { controller = "DefaultPage", action = "Error404" });
4. Use httpErrors to direct to Your 404 action (<error statusCode="404" path="/notfound" responseMode="ExecuteURL" />)
5. Controller:
[BVNetwork.NotFound.Core.NotFoundPage.NotFoundPage] public ActionResult Error404() { var startPage = ContentReference.StartPage.GetPage<StartPage>(); var notFoundPage = startPage.NotFoundPage.GetPage<StandardPage>(); ControllerContext.RequestContext.SetContentLink(startPage.NotFoundPage); Response.StatusCode = (int)HttpStatusCode.NotFound; Response.TrySkipIisCustomErrors = true; var model = CreateModel<StandardPage>(notFoundPage); return View("~/Views/StandardPage/Index.cshtml", model); }
No comments:
Post a Comment