How to get roles list assigned to a Page in Visible to property


Hi Everyone,

So i have a requirement where i created 2 roles from Admin panel in CMS and then to each page of my site im assigning them the rights and role in the Visible to property on the top.

Now in my MVC code i want to fetch the role and the access rights given to that page based on which i will let the user see the page or redirect them to login. My user does not exists in Episerver as im using another mode of login in the application . Im redirected back to my application after login from 3rd party app which calls my Authorization filter in which i want to check the requested page roles and rights assigned to it.

I tried QueryAccess method after going through some post but it just tells me the read and write access but not the role name.

Apr 09, 2020 12:51


You can retrieve the assigned roles and permissions for a given page from the ACL property of the page like this:

foreach (var entry in currentPage.ACL.Entries)
    if (entry.Name == "Administrators" && entry.Access != AccessLevel.FullAccess)
        //Do stuff
Apr 09, 2020 13:15
Paul Gruffydd - Apr 09, 2020 13:18
For the record, this sounds like something which might be better handled by integrating your authentication mechanism to Episerver though.
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.