Search code examples
asp.netasp.net-membershipforms-authenticationdata-migration

How to migrate existing users to Forms Authentication


How do I migrate users from a existing users table to Forms Authentication?

There seems to be three options:

  1. T-SQL - Iterate through the existing users table and insert into Forms Authentication tables using the stored procedure aspnet_Membership_CreateUser

  2. Code - create a utility that will iterate through the existing users table and insert into Forms Authentication tables using Membership.CreateUser()

  3. Code - as users login verify credentials against existing users table and insert into Forms Authentication tables using Membership.CreateUser()

Which is the most practical?

I have been currently trying option 1 but I am running into difficulties using the password salt to create the encrypted password from a plain text password


Solution

  • With regard to #1, what exactly is the problem? You don't need to worry about the hashing if you've got plaintext passwords already. Just call CreateUser(username, password). Simple as that.