Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Jeff Lewis 14 posts 84 karma points
    Mar 07, 2020 @ 17:55
    Jeff Lewis

    Dynamic Navigation - Member Has Access


    I have an issue where my dynamic navigation view is causing very slow page load times because it has to check whether a member has access for every visible piece of navigation content via code similar to this:

    IEnumerable<IPublishedContent> navigationPages = homePage.Children(x => x.IsVisible());
    @foreach (var item in navigationPages)
          { var access = Umbraco.MemberHasAccess(item.Path); }

    I have Public Access set up for all of my member-area content by using the member groups, which I believe is correct, but I wonder if there's a better way of doing this than using @Umbraco.MemberHasAccess(item.Path);?

    I see a lot of SQL queries in the profiler in Visual Studio for every page request, which are significantly reduced along with page load times if I comment out the line checking Umbraco.MemberHasAccess(item.Path);.

    Are there any alternatives to this? Am I doing this correctly?



  • Shaishav Karnani from 353 posts 1637 karma points
    Mar 09, 2020 @ 08:33
    Shaishav Karnani from

    Hi Jeff,

    You need to apply caching of data to ensure Navigation is cached per user. Therefore, you will start reducing queries quite a lot rather than calling for each page.

    1) HttpContext.Current.Cache - For data cache 2) or use MemoryCache.Default

    Hope that helps to solve your issue.



Please Sign in or register to post replies

Write your reply to: