Tim Almond
Tim Almond

Reputation: 12696

ASP.NET SQLMembershipProvider - email as username

I'm about to start building a new asp.net project, and I'm just starting out with the whole thing of SQLMembershipProvider. What I really want to do is to remove the need for a username and just have the key to the user as the email address.

It seems to me that the easiest thing might be to change the stored procedures to just remove the email address from the tables, and when someone does a search by email, just to use the key (I also need to deal with someone changing their email address...

Before I start, does anyone know a pre-rolled example out there. It just seems too common to have to build it.

Upvotes: 2

Views: 1667

Answers (2)

Mehrdad Afshari
Mehrdad Afshari

Reputation: 422006

You don't need to change anything in the provider. Just set the email as user name upon registration and don't provide any means in the UI to change the email address. It'll do the work easily.

Upvotes: 6

Quintin Robinson
Quintin Robinson

Reputation: 82335

You could modify the procedures... or just omit the email or username fields in your forms/ui and use one or the other behind the scenes to populate the other field. This might be duplicate data, but you might find a need to have an email that isn't also the username down the road.

Upvotes: 1

Related Questions