问题描述
嗨我想使用登录表单并创建用户向导,但工具箱中提供的登录控件使我感到困惑.所以我自己创建了表格,如下所示
ID用户名(PK)密码电子邮件序列问题回答角色
1 krishna windows @ krishna @ yahoo.com您的伴侣? Microsoft管理员
2 suresh billgates @ [email protected]您的伴侣? Google员工
现在,我可以读取用户名和密码并将其分配给Forms Authentication
但是问题出在角色上,我想将角色分配给表单身份验证角色
我认为可能像下面的
字符串角色=(从数据库获得的值;
User.Identity.RoleName = role;
Hii wanted to use login form and create user wizards but the login controls provided in toolbox makes me to confuse.so i created the table by my own like below
ID UserName(PK) Password Email SequerityQuestion Answer Role
1 krishna windows@ [email protected] your partner ? Microsoft Admin
2 suresh billgates@ [email protected] your partner ? Google Employee
now i can able to read the username and password and assign them to Forms Authentication
but the problem is with Role i wanted to assign Role to the Forms authentication role
i think it may like below
string role=(value obtained from database;
User.Identity.RoleName=role;
推荐答案
这篇关于以编程方式分配角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!