I Create a user with the CreateUser Wizard and all is OK - 1 record in aspnet_Users table, and 1 record in aspnet_Membership table with matching UserId. Then I add user to roles:
if (!Roles.IsUserInRole(username, rolename))
Roles.AddUserToRole(username, rolename);
I end up with 2 records with same UserName in aspnet_Users - different UserIds (old and new), the aspnet_Membership table is unchanged, and aspnet_UsersInRoles table has the new UserId associated with the role. All is fine until I delete the user - I'm left with a record in aspnet_Users with the new UserId.
Why is a duplicate UserName record with a new UserId created in the aspnet_Users table when I call AddUsersToRole?
Can this be corrected so the aspnet_UsersInRoles table uses the original UserId, instead of creating a new UserId for a duplicate UserName, and there is no duplicate record by UserName in the aspnet_Users table?
Thanks - Brad