We help IT Professionals succeed at work.

CreateUserWizard email field problem

McGurk1 used Ask the Experts™
I am using this wizard to create a form to allow users to register in my asp.net program.  
When a duplicate email address is entered, the wizard gives a message telling the user to enter a different email address.  All that is good.  However, and I have seen this happen in other apps on the web when I have tried to register, when the "user" tries to enter a different email address to complete the registration, the wizard errors with the message:  "The user 'myuser' is already in role 'myrole'." or "the user already exists".    I look in my db and the wizard has added the user to the users and usersinroles tables.  The result is the user is forced to start all over creating a different user name  because the wizard entered it into the database but will not allow the email to be changed. I added the following to the web config <providers> section but it does not help.

Open in new window

What I want to do is allow the user to enter a new email address if the email address is a duplicate and then have the createuserwizrd continue to create the appropriate records to complete the registration.

Haven't found any answers on the web yet.  Thanks for any help you may have on this.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013
If you added requiresUniqueEmail="true" to your web.config after you got that error...
you can change the Email Address like below via code:

MembershipUser user = Membership.GetUser("Username");
        if (user != null)
            user.Email = "NewEmail";


would help to indicate where to place the code


Perfect!!!!   Thank you for answering so quickly.

I put the code in the CreateUserWizard1_CreatedUser sub.