M# Tutorials

Learn to build .NET applications with M#. Our step-by-step tutorials will get you up-to-speed rapidly.
If you already know ASP.NET and C#, you can master M# in a week or two.


In this lesson we will learn how to implemented role based security on a page and how pages inherit roles. All pages of a website in M# are visible to “Guest” role, unless any other role is explicitly specified. This means pages created in M# will be accessible for all the users unless restricted to a specific role. You can specify roles at page, module or module element level.

For more infomation about creating and managing roles please read lesson "Roles" in chapter 13.

Implementing Role on Pages

We will create a new page called “Employees” in our website, then we will add all the “Employee” entity related pages under this page and then will apply roles. (For more information on creating a page please read lesson Entities, Page, Moulde in chapter 1)

Important: It is a good practice to group role specific pages under one parent page. Because subpages inherit roles, it will be easier to implement and maintain roles on a single page rather than each individual page. But of course, you can implement additional roles on subpages. You can define multiple roles e.g. a page can have “Administrator and Employee” roles.

In order to implement a role, please follow the steps below:

• Select you desired page (In our case, It’s “Employees” )

• Click at the end of page specific attribute

• Select “Roles” option from the context menu (you can also write to filter the context menu option. In our case, it’s “Roles”)

• Next, Select the required roles from the available list and click “Save”

At this stage we have successfully set up and implemented Employee role on page level. Now all the pages created under this page will only be accessible by the users logged in as Employee.

The site map is also updated for this page to have a role of “Employee”.

Roles can also be implemnetd on modules and module elements e.g. buttons, button actions, list columns etc. using same approach.