Hi Daniel L,
If I understand you correctly, you want the page to be hidden for the Subscribers role in your site map menu. So if somebody enters your site, they see the "subscribe" link only if they are not subscribers. With the basic Sitefinity page settings this is not possible, but you can achive it with just a few lines of code.
The default behavior is that for every page first the "show in navigation
" property is checked, if it is set to true,
the "anonymous access
" is checked and only if it is set to deny
, roles are considered. In your case if you set "deny anonymous access", whatever you do, unauthenticated users won't be able to visit this page.
In the attached file you'll find a custom sitemap provider that overrides the method "IsAccessibleToUser
" and performs the needed check in order to filter only users that belong to the "Subscribers" role. You can further extend this functionality if you like.
In order for the example to work properly, you have to change the name of the default site map provider in your web.config:
|<siteMap defaultProvider="CmsSiteMapProvider" enabled="true">
| <add name="CmsSiteMapProvider" description="Displays Cms Pages" type="CustomSiteMapProvider"/>
Then add the attached class to your app_Code folder. Finally, you have to create the
"Subscribe" page, set "show in navigation
" to true
and "anonymous access
" to allow
. Having this done, users in the "subscribers" role won't be able to see it in the navigation controls.
Please have in mind that despite the changes, they will be able to visit the page as it is not forbidden. If you need to deny access to a page and not just exclude it from the site map, please contact us again and we'll be happy to provide a solution.
All the best,
the Telerik team