Copied to clipboard

Flag this post as spam?

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

  • Andreas Kaltenhuber 107 posts 284 karma points
    Feb 28, 2017 @ 13:00
    Andreas Kaltenhuber

    role-based navigation - slows down rendering


    whats the best way to render a role based navigation?

    There is a function Umbraco.MemberHasAccess(string path) that should handle this.


    foreach (var node in Model.Content.Children)
        if (!Umbraco.MemberHasAccess(node.Path))
        //member has access, generate menu here

    But this function slows down the rendering as it does lots of duplicate roundtrips.

    Thx in advance,


    Umbraco 7.5.10

  • David Peck 589 posts 1557 karma points c-trib
    Mar 07, 2017 @ 13:25
    David Peck

    I'd look in to Donut caching, where you 'vary by custom string' such that the string represents the User's role or Id.

    Alternatively, just create a decent view model for all the site pages that might be rendered and cache that model. The don't worry about the view running each time as it should be relatively fast. I don't think Umbraco.MemberHasAccess will hit the database.

Please Sign in or register to post replies

Write your reply to: