问题描述
我正在开展一个项目。有以下。
数据库。
一个名为Person的表。
一个名为PersonRole的表。
MVC项目。
- 区域
- 客户
- 团队
- 管理员
- Webconfig(根级别)
i已在区域中的管理员,客户,团队目录中配置了角色。
最后
当我尝试访问管理目录时,它会将我重定向到登录页面。是的,对!
我登录并获得了具有角色的用户对象。
但我不知道如何比较角色并允许在适当的目录上访问当前用户。
的临时解决方案我已经创建了受尊重角色的自定义属性,它对我的工作正常,但我想要整个目录。
注意:(我没有使用Asp.net会员API)
I am working on a project. which have following.
Database.
A Table named Person.
A Table named PersonRole.
MVC Project.
- Areas
- Customer
- Team
- Admin
- Webconfig (root level)
i have configured role on the Admin,Customer,Team Directory in Areas.
Finally
When i try to access the admin directory it redirects me to the login page. yeah right!
i logged in and got the user object having role.
but i dont know how do i compare the role and allow the access to current user on appropriate directory.
for the temporary solution i have created the custom attribute for the respected role it works fine to my but i want something like on the whole directory.
Note: (i am not using Asp.net Membership API)
推荐答案
这篇关于Asp.net MVC角色管理。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!