I implemented the membership in asp.net 4.0, I have 3 roles(manager,operator,user) and 2 user (manager,operator). manager can define the user, I do that by this code:
Membership.CreateUser(txtUserName.Text, txtPassword.Text, txtEmail.Text);
and I set its role by below code:
Roles.AddUserToRole(txtUserName.Text, "user");
now when the user want to log in, I check the user by:
if(Membership.ValidateUser(txtUserName.Text, txtPassword.Text)){
string[] role = Roles.GetRolesForUser(txtUserName.Text);
.
.
.
}
and I check the role array, but it is null, and I can not get the role of user, of course when I log in by manager or operator there is no problem,
now my question is that why my user role is null?
thank you so much!!!!!
Have you added the roles provider to the web.config?