I'll use my standard tip: use static html pages for error pages and remember to turn off Episervers default error handling to avoid any infinite loops. There is a flag on application settings in web config file to turn off global error handling.
Use asp.net standard way to redirect to your static pages. Works every time. No Hazzle. Perfect performance. Some things you actually don't want to use Episerver for.
...and that's from someone who really likes to use Episerver for more or less everything :)
Had the same issue, solution:
(additionaly I`m using BVN404 Handler)
1) <customErrors mode="Off" />
2) global error handling => false
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);
}
Thanks for the replies.
When I get time I will try out Michal's suggestion and if that does not work we will switch to deliver static error pages as a fallback.
Hi
Did you manage to resolve the slowness issue. I have followed the steps provided but it still does not seem to help. The only step I am not 100% sure is below
2) global error handling => false
Could you please let me know if anything specific needs to be turned off.
If I use an html 404 page it loads instantly.
Kind Regards
Sandeep
Hi
Have just managed to figure it out
In order to resolve the issue you need specifically turn global error handling off
<applicationSettings globalErrorHandling="Off"
Kind Regards
Sandeep
Hi,
Have you guys considered using another tool?
I'm planning to use this on the new website we are building.
https://github.com/huilaaja/RedirectManager
Thanks
Ram
Hi Ram
Seems a slightly advance version as compared to BVN .
We have already implemented BVN in our current project so would be a lot of work for us to re-implement this and do all the testing again. A bit nervy also to use a relatively new module. BVN one is quite widely used and tested.
However please update the ticket with how you got along so that we can cosider it during our next project.
Kind regards
Sandeep
I am currently trying to figure out why it takes a long time (60+ seconds) to get into the ErrorPageControllers Index action for a site with EPiServer 9.10 and Commerce.
The custom error page is implemented as described here: http://www.karolikl.com/2013/09/dynamic-error-handling-in-episerver-7.html
When trying a url that is incorrect directly under the start page it take a long time, if tryin a non-existing page under a sub-folder it does not take long time.
Slow: http://some.site/does-not-exist
Fast: http://some.site/does-not-exist/page-that-does-not-exist
The commerce part is using HierarchicalCatalogPartialRouter to map commerce items into the main website. I have completely disabled that without any change in the slow loading of the custom 404 page.
Even though it take time, it still loads the 404 page correctly.
How can I figure out what is taking up all that time for the incorrect URLs?
Thanks,
Andreas