In this tutorial, you will learn how to restrict pages within Umbraco CMS. If you need to create a members-only area, or to create a page that only certain people can access then this guide is written for you. 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 within a Umbraco project you will need to deal with two concepts, members and groups. I assume that all you beautiful readers will know the difference between the two, so let us focus on which type will best serve our purposes.

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 every single time a new member registers, you can add them to a role and the changes will be propagated across the system.

New roles and new members are created within the CMS. Log into the Umbraco backend and open the member section. To create a new member click on the 'create member' button within the 'members' tab. To create a new group/role click on the 'create' option from the 'member groups' section:

Umbraco Restricting Pages

To restrict a page by role, within the backend content tree, navigate to the page that you would like to restrict. Open the pages options menu. This can be done by right-clicking on the page and selecting the 'public access' option:

Umbraco Restricting Pages

From this screen, you will be able to set the page access rules. By default, Umbraco will allow everyone to view a page. To restrict a page, simply add the role that you want to restrict it by. From this screen, you will also be able to set the page that Umbraco will redirect any unauthorized requests. In a member-area website, this is usually the log-in page. In this example, I have set my error and login page to point to the not found page. This is a security trick so would-be hackers will not know the page exists!

Setting Error Page For Umbraco Page Restriction

After applying the restrictions, if you try to view the page you should either see a not found page or get redirected to the page!

Happy Coding!