开发者

What reasons could cause WebSecurity.ChangePassword() to FAil?

I'm working on a Razor project and need to integrate an existing User database into the SimpleMembership Provider DB Schema. This is done by specifying my existing User table and which columns are to be used by the SimpleMembership API for the Username and UserID.

WebSecurity.InitializeDatabaseConnection("DB_ConnStr", "User", "UserId", "Username", true);

In the process though, I am populating the webpages_Membership table with a new record for each User row in my existing database. This has gone fine and I have written some code to handle the inserts for each existing user.

During the insert, I use a dummy encrypted password token for simplicity and set the password to be the same for everyone. Then I need to run another script over the records to set the correct password for each user i开发者_开发知识库n the webpages_Membership table. This involves decrypting the current password from the existing User table, and then calling:

WebSecurity.ChangePassword( username, dummyPwd, newPwd) 

on each user, passing the decrypted current password as the 'newPwd' parameter.

This works fine in 99% of the cases that it's called - for over 100,000 records. But it is failing in about 40 cases.

What reasons could cause this method to fail?


My first guess would be that the hash of the new password might be exceeding the 128 character limit.

When the ChangePassword call fails, can you catch the exception to get details behind the reason of the failure?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜