Replacing Username with Email

J

Jonathan Wood

I'm using ASP.NET membership functionality.

My problem is that I think I'd rather have each user account keyed on an
email instead of a user name. My main problem with user names is that
duplicates become likely and I don't want people to have to enter a bunch of
different user names before a unique one is found.

I know I can change the prompt of the login control to read email instead of
username. Has anyone done this? Anything else I need to worry about?

BTW, I know there is an option to make emails unique but that wouldn't be
enough for what I want. I want to be able to create new accounts using an
email address and an automatically-generated password.

Thanks.
 
S

Scott Roberts

I know I can change the prompt of the login control to read email instead
of
username. Has anyone done this? Anything else I need to worry about?

We made our own registration form and put this code behind the submit
button:

MembershipUser user = Membership.CreateUser(Email.Text, Password.Text,
Email.Text);
Roles.AddUserToRole(user.UserName, "Merchant");
FormsAuthentication.SetAuthCookie(user.UserName, false);

We've had no problems at all with it.
 
J

Jonathan Wood

Cool, I'll give that a go.

One question: can I ask why you wrote this code instead of just using the
Login control?

Thanks.
 
S

Scott Roberts

Jonathan Wood said:
Cool, I'll give that a go.

One question: can I ask why you wrote this code instead of just using the
Login control?

Sorry, you asked about the login control but my answer was talking about
registering a new user. We do use the built-in login control for logging in.
 
J

Jonathan Wood

Oh, you use the login control, but not the CreateUserWizard control? Is that
right?
 
S

Scott Roberts

Oh, you use the login control, but not the CreateUserWizard control? Is
that
right?

Correct. We just wanted a different look & feel for our registration page.
 
A

Alexis

Hello Jonathan,
Were you able to use the login control with email instead of the username?
I need to do just that?

Thanks,
Alexis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top