简体   繁体   中英

How to use autentication with roles on ASP.NET MVC

I have a question for all the ASP.NET veterans, I'm currently working on a project involving displaying different pages to users with different roles. For example, Admin Can add new users to the website Role-x users can edit the database A Role-y users can edit database A & B Role-Z users can access views of database B so my question is how can I implement this (serving different pages to different users based on their credentials(Roles)). I just need a little guide to what I have to implement. Thanks in advance.

Here you can found some good tutorials about authentication and authorization, please check it:

Introduction to ASP.NET Identity

A better way to handle authorization in ASP.NET Core

and here some more simple approach:

Role Based Authentication In ASP.NET MVC

If your question is more about Database please add the corresponding Tag.

Edit:

Here one more link that I highly suggest you, it explain step by step how to implement very clearly, there is example (4 tutorials) from Authentication and Authorization in MVC until Role-Based:

Authentication and Authorization in MVC

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