Posted on: 12/24/2013 1:11:01 PM | Views : 840

Hi,
I am trying to add a user to a role, in the example below which is just to explain the issue at the various points, I create a user, check the user exists with GetUser, check the role exists, and then add the user to the role. The problem I am having is that when I call AddUserToRole I get an error "The user cannot be found", which I can't understand, especially as I actually pass the user name from the MembershipUser.UserName.
MembershipUser user = Membership.Provider.GetUser(txtUserName.Value, false); //Get user if (user != null) //Does user exist { Membership.DeleteUser(txtUserName.Value); //Delete the user } try { Globals.gloE.grabEmail(txtUserName.Value, Globals.ip, Globals.basedn); string email = Globals.gloE.gotEmail; if (email == "") ...

Go to the complete details ...