Duplicate User name when trying to add new member.
I have hit a wall (again, seems to be a daily thing for me at the moment) and just can not work out what is going on.
When I try to create a new member with the code below (all samples are in a c# user control)
MemberType mt = MemberType.GetByAlias("WebsiteUser");
Member newMember = Member.MakeNew(Email.Text, Email.Text, mt, new umbraco.BusinessLogic.User(0));
or (because it seems like the above sample is depreciated)
MembershipUser user = Membership.CreateUser(Email.Text,Password.Text);
or via the CreateNewUserWizard
I get "Duplicate User name". Every time, for every user name I try. Now, I know there is no user in the dbase called 333DeadCatOnTheHighway. But just in case I somehow missed it when looking through the dbase I tried about 20 different other names just to confirm it wasn't bad luck.
My web.config has an UmbracoMembershipProvider pointing to WebsiteUser as its default member type. WebsiteUser does have a few custom properties but at this point I am not trying to do anything with them. I have confirmed I can add new members via the Umbraco UI.
Anyone have any ideas why I am getting a Duplicate User Name error?
Resolved - Prior to an update to 4.5.2 a user with blank details was added as a member - this member was probably in the database for weeks without any issue. Something in 4.5.2 caused that blank user to be returned for every create member function hence Duplicate member errors.
This was so frickin annoying and i've wasted so much time and lost face with one of my clients because of this bug! So glad I found this post! Cheers guys.
As far as the cause, in my case someone had entered spaces at the beginning and end of their username. Somehow that cause the username to be spaces. So now I'm trim()ming any user names before creating users.
Duplicate User name when trying to add new member.
I have hit a wall (again, seems to be a daily thing for me at the moment) and just can not work out what is going on.
When I try to create a new member with the code below (all samples are in a c# user control)
or (because it seems like the above sample is depreciated)
or via the CreateNewUserWizard
I get "Duplicate User name". Every time, for every user name I try. Now, I know there is no user in the dbase called 333DeadCatOnTheHighway. But just in case I somehow missed it when looking through the dbase I tried about 20 different other names just to confirm it wasn't bad luck.
My web.config has an UmbracoMembershipProvider pointing to WebsiteUser as its default member type. WebsiteUser does have a few custom properties but at this point I am not trying to do anything with them. I have confirmed I can add new members via the Umbraco UI.
Anyone have any ideas why I am getting a Duplicate User Name error?
Resolved - Prior to an update to 4.5.2 a user with blank details was added as a member - this member was probably in the database for weeks without any issue. Something in 4.5.2 caused that blank user to be returned for every create member function hence Duplicate member errors.
This is weird but I had the same problem and same resolution - removed the member with the blank login id from the cmsMember table
This was so frickin annoying and i've wasted so much time and lost face with one of my clients because of this bug! So glad I found this post! Cheers guys.
I'm on v4.5 and this still has not been fixed. Great post though - scratchin' my head on this one until I found this.
(it does beg the question as to how corrupt data originally got into the cmsMember table tho)
We too had the same issue and thanks for this post. The issue was solved though we spent whole day in debugging.
same here, thanks! very annoying
though, for me it creates a blank user even though i have a check to see if emailfield is not null before creating user. but still i get "
The parameter 'username' must not be empty.
Parameter name: username "
and then it creats the user with blank émail and loginname.
any thoughs on solution?
regards / Marcus
Removing empty entry from the members table also solved my problem. thank Umbracos
Yep, fixed my problem as well.
As far as the cause, in my case someone had entered spaces at the beginning and end of their username. Somehow that cause the username to be spaces. So now I'm trim()ming any user names before creating users.
is working on a reply...