开发者

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开发者_如何学Go 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


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.


Have you considered implementing your own MembershipProvider class that hits only your user table?

Trying to synchronise data between two tables may seem trivial now, but may cause you a whole world of hurt in the future as your software evolves.


Just to confirm are you saying you've got an existing users table in your database and you want to use asp.net membership and the membership tables generated?

If that is the case you don't necessarily need to migrate your data. You could extend the membership provider and create your own membership that links into the existing table you already have.

Here's a couple of link if it helps:

Asp.net video

Writing A Custom Membership Provider

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜