Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

c# - 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...