views:

97

answers:

1

Currently I have a site (asp.net 3.5) that uses a unique ID for the login. I am going to need to switch it to use emails if possible. I am going to be creating all new accounts so I can wipe the membership table clean and import all the user info.

We are switching from generic logins for departments to individual accounts.

Any links or pointers in the right direction would be greatly appreciated.

+1  A: 

So here is what you should do. If you are creating a entire user base just wipe of the current ones and tell users to create the new user with a email, as long as you validate that on the entry form you are going to be good. Now if you already have a user base, then is a little more complicated. First verify that every current user has a valid distinct email, then you have to change 2 columns on the aspnet_Users table, the columns are UserName, and LoweredUserName. That should be simple if the first step is true, just do a loop for every aspnetMembership row, get the column Email and set as UserName, then get the column LoweredEmail a set as LoweredUserName.

Ta daaaaaa!

Now you have it all migrated to the new model, for new entries, make sure that the entry form validates the UserName to be an email, for that you can use RegEx.

Oakcool
Wow this just got a little interesting. I have been able to make the switch.. THANK YOU EVERYONE FOR HELP. But as we all know things change. Is it possible to keep the old accounts in the DB and just start adding the new accounts that are email based? So it would be a hybrid of Old User ID's and then the new Email User ID's. Emails on all the accounts would be unique too.I am hoping i can do this. and then when they are done with the old accounts and the switch to the email id has been made we can delete the old id's to clean up.Does that sound doable?
JPJedi
You might have a problem because the email in the new account will be the same as the old one, if thats not a constrain, then there is a SP that created with the asp_net membership system, that you can use to create the new accounts, and it should be the same thing.The other thing you may do is notify the users that after date xxx they will only be able to log with there email address, and if can give then a chance to change the email on the account, so when you move, they will be ready.
Oakcool