Custom 404 page slow to get into controller

Member since: 2011

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:

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.


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?


#149572 Jun 03, 2016 15:04
  • Member since: 2005

    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 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 :)

    #149849 Jun 08, 2016 19:27
  • Member since: 2010

    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:

    public ActionResult Error404()
    var startPage = ContentReference.StartPage.GetPage<StartPage>();
    var notFoundPage = startPage.NotFoundPage.GetPage<StandardPage>();

    Response.StatusCode = (int)HttpStatusCode.NotFound;
    Response.TrySkipIisCustomErrors = true;
    var model = CreateModel<StandardPage>(notFoundPage);

    return View("~/Views/StandardPage/Index.cshtml", model);

    #149871 Jun 09, 2016 12:32
  • Member since: 2011

    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.

    #150210 Jun 14, 2016 8:08
  • Member since: 2006


    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


    #189160 Edited, Mar 13, 2018 2:23
  • Member since: 2006


    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


    #189231 Mar 13, 2018 22:12
  • Member since: 2017


     Have you guys considered using another tool?

    I'm planning to use this on the new website we are building.



    #189232 Mar 14, 2018 1:46
  • Member since: 2006

    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


    #189233 Mar 14, 2018 1:52