In this tutorial, you will learn how to restrict page within Umbraco CMS. If you need to create a members-only area then the main requirement will be to only allow certain people access to certain pages. The good news is that restricting a page can be done entirely within the CMS. No code will need to be written in the making of this tutorial. To create a restricted area on within a Umbraco project you will need to deal with two concepts:
Roles are the equivalent of groups. Restricting a page by a group will make the membership management simpler. When you need to add or remove users, instead of having to update multiple pages with the new member, you can them to a role and the change will be propagated across the system. New roles and new members are created within the CMS. Log-into the back-end and click the member's section. To create a new member click on the 'create member' button within the 'members' tab.
New roles and new members are created within the CMS. Log-into the back-end and click the member section. To create a new group/role click on the 'create' option from the 'member groups' section:
To restrict a page by role within the backend content tree, navigate to the page that you would like to restrict access to. Open the pages option tab by right-clicking on the page and select 'public access':
From this page, you will be able to set which roles can access the page. By default, Umbraco will set access to allow everyone to view the page. To restrict a page add the group. You can also decide which page Umbraco will redirect a user to the login page if they do not have access. This page will usually be the log-in page. In this example, I have set my error and login page to point to the 404 page:
After applying the restrictions, if you try to view the page you should either see an error page or get redirected to the page!