ASP.Net无需使用ASPNETDB即可将角色分配给用户 [英] ASP.Net assign roles to User without Using ASPNETDB

查看:84
本文介绍了ASP.Net无需使用ASPNETDB即可将角色分配给用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

从最近几天开始,我一直在寻找解决方案.
我正在使用asp.net,c#.net 4.0和sqlserver 2008开发应用程序.
我想创建具有fname,lname,mobile num,address .... like的Users,并且只想通过在下拉列表中选择Roles来在创建用户时将用户分配给角色.
我没有使用aspnetdb数据库.
谁能告诉我如何实现这一目标.
谢谢您,

Hi All,

From last few days i am searching for a solution.
I am developing an application using asp.net,c#.net 4.0 and sqlserver 2008.
I want to create Users with fname,lname,mobile num,address....like and I want to assign users to roles at the time of user creation only by taking Roles in a drop down list.
I am not using aspnetdb database.
Can any one tell me how to achieve this.
Thank you,

推荐答案

实现您自己的MembershipProvider-非常简单,并且MSDN文档还可以:RoleProvider [ ^ ]大致相同.
Implement your own MembershipProvider - it''s pretty simple and the MSDN documentation is ok: http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx[^] Yoiu can also create a RoleProvider[^] in much the same way.




您需要手动执行所有操作.首先,您需要创建主表(包含角色数据).那么每个角色可能具有不同的功能,因此您还需要另一个主表来列出该角色所具有的功能. EX:管理员拥有所有权利,但审阅者拥有最少的权利.因此,您可以通过这种方式定义页面级别/功能的明智权限.

现在,您的下一步将是创建一个包含名为isValidated的属性的类.在登录页面上,您需要检查所有角色和相关功能并启用isValidated标志.

让我知道是否不清楚.

-Amit
Hi,

You need to do everything manually. first of all you need to create master tables(contain data of roles). then each role may have different functionality so you also need another master table for list out what are the functionality role have. EX : Administrator have all rights but Reviewer have minimal rights. So this way you can define page level / functionality wise rights.

Now your next step would be to create one class that will contain property named isValidated. on login page you need to check all the roles and related functionality and enable isValidated flag.

let me know if this is not clear.

-Amit


这篇关于ASP.Net无需使用ASPNETDB即可将角色分配给用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆