Hi!
I want to change the UserName but its read only.
var memberShipProvider = Membership.Providers["SqlServerMembershipProvider"];
var user = memberShipProvider.GetUser(providerUserKey, false); //Returns my user
user.UserName = "new@email.com"; //PROBLEM read only
user.Email= "new@email.com"; //WORKS but its not the username =)
memberShipProvider.UpdateUser(user);
how would you do it? The things i have tested
- Create a new user with the roles from the old one and then delete the old user. Problem here was to keep the password since the GetPassword of the Roles provider needs to be enabled in web.config and only works on hashed password (thats what we are using)
- Other things that i can try is to change it directly in the database but that feels like a big no no?