简体   繁体   中英

ASP.NET Identity Manager to manage page level user access

Now that I can use ASP.NET Identity Manager to manage the users and Roles. By the way, I am doing it in web form at the moment.

Next what I want to learn is what will be a good way to manage the page based on Roles. Means example Admin Role can access to page1.aspx and page2.aspx while User Role can access to only page3.aspx.

Write my own custom code or there is a Microsoft built-in class to do this?

Regards, Steve

For Web Forms and MVC you can add the Authorize attribute to the class or each method for to implement role based permissions on a per page basis.

[Authorize(Roles = "User,Admin")]

If you need to go beyond that you will need to build your own code to suit your needs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM