1

ユーザーを既存のユーザー テーブルからフォーム認証に移行するにはどうすればよいですか?

次の 3 つのオプションがあるようです。

  1. T-SQL - 既存のユーザー テーブルを反復処理し、ストアド プロシージャ aspnet_Membership_CreateUser を使用してフォーム認証テーブルに挿入します。

  2. コード - 既存のユーザー テーブルを反復処理し、Membership.CreateUser() を使用してフォーム認証テーブルに挿入するユーティリティを作成します。

  3. コード - ユーザーがログインすると、既存のユーザー テーブルに対して資格情報が検証され、Membership.CreateUser() を使用してフォーム認証テーブルに挿入されます。

どれが最も実用的ですか?

現在、オプション 1 を試していますが、パスワード ソルトを使用してプレーン テキストのパスワードから暗号化されたパスワードを作成するのが困難です。

4

3 に答える 3

1

#1に関して、問題は正確には何ですか?平文のパスワードがすでにある場合は、ハッシュについて心配する必要はありません。CreateUser(username, password) を呼び出すだけです。そのような単純な。

于 2010-02-20T00:02:25.777 に答える
0

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.

于 2010-02-19T15:29:22.897 に答える
0

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

于 2010-02-19T15:30:28.307 に答える