Reputation:
in my web site, i have three roles(Editor , Reviewer and Author) In some situations I need to add my user all 3 roles by coding. i use this code and it save all the users but. i can not log in with the user name and password. please guide me thanks.
Membership.CreateUser(TextBox1.Text, "123456", "email");
Roles.AddUserToRole(TextBox1.Text, "Editor" );
Roles.AddUserToRole(TextBox1.Text, "Author");
Roles.AddUserToRole(TextBox1.Text, "Reviewer");
Upvotes: 0
Views: 53
Reputation: 15498
call the extended version of CreateUser that returns the status. make sure it returns a success status. Also, to some sanity checking by calling the Roles.GetRolesForUser("..") or something like that just to confirm your roles really got added.
Upvotes: 1
Reputation: 5751
Check that the user account is marked as Approved and not Locked Out. You may have configured the membership system to create accounts in state "Not Approved", or you may have tried to log in too many times with an invalid password.
Upvotes: 1
Reputation: 2493
The role can be only one. Create a role that includes all rights of all these roles and assign it to user
Upvotes: 0