开发者

Access datas based on user role in asp.net

开发者 https://www.devze.com 2023-02-19 04:08 出处:网络
How to access datas based on user roles in asp.net ? For example : i have two admins (admin1, admin2) .

How to access datas based on user roles in asp.net ?

For example : i have two admins (admin1, admin2) .

In the frontend ,admin1 has full access to datas(view,add,edit,delete all datas)

开发者_运维知识库

while admin2 has limited access to datas(view,add,edit,delete certain datas alone and not all datas)

thank you


Just use the Roles.IsUserInRole method to qualify whether a user is in a role or not then show the corresponding data.

Roles.IsUserInRole(<USERNAME>, <ROLE>)


You could use the code Ira Rainey posted to toggle control using code or you could use a LoginView Control.

Check the Displaying Role-Specific Markup With the LoginView Control section of this article (go down the page) to get an overview.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号