如何使用 ASP.NET 角色处理成员级别
我正在建立一个基于订阅的网站,目前有三个订阅级别,即马匹、足球以及马匹和足球。我正在考虑实现基于标准角色的授权,其中“马”订阅者将获得角色,包括使用“马”部分等的角色。
我是否应该使用标准角色提供程序,并且当成员订阅该网站时,为其订阅分配角色他,或者使用分层角色提供程序,当询问成员的角色时,只有然后使用该成员的订阅级别来“计算”该成员的一组角色。
I am building a subscription based web site, which currently has three subscription levels, i.e. Horses, Soccer, and Horses and Soccer. I was thinking of implementing standard role based authorization, where a Horses subscriber would get roles including those to use the Horses section, etc.
Should I use a standard role provider, and when a member subscribes to the site, assign roles for his subscription to him, or use a hierarchical role provider, that when asked for the roles for a member, only then uses the member's subscription level to 'calculate' a set of roles for the member.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与方法 2 相比,方法 1 更具控制性和确定性。
这取决于您拥有多少个“公共”区域。如果有手动公共区域并且角色仅适用于选定的少数内容,我会选择选项 2,否则选项1.
Approach 1 is more controlled and deterministic as opposed to approach 2.
It will depend on how many 'public' areas you have.. If there are manu public areas and roles apply only to chosen few content, I would go with option 2 otherwise option 1.
似乎是 aspnet 角色,并且分配角色对我来说似乎是一个很好的解决方案,需要最少的代码
Seems to be aspnet roles and assing the roles seems like a good solution to me that requires minimal amount of code