如何通过sql server更改或更新asp.net成员资格中的密码

时间:2012-01-24 11:46:49

标签: asp.net sql sql-server-2008 asp.net-membership password-recovery

我必须将密码更改为其他内容,我已获得所有详细信息,例如useridusernameencrypted passwordpassword format

如何在asp.net会员资格中通过SQL更改密码?

1 个答案:

答案 0 :(得分:34)

您可以使用此查询;

Declare @UserName NVarChar(30)    
Declare @Password NVarChar(30)    
Declare @Application NVarChar(255)    
Declare @PasswordSalt NVarChar(128)    

set @UserName = 'UserName'    
set @Password = 'Pass'    
set @Application = '/Application'    
Set @PasswordSalt = (SELECT 1 PasswordSalt FROM aspnet_Membership WHERE UserID IN    (SELECT UserID FROM aspnet_Users u, aspnet_Applications a WHERE u.UserName=@UserName and a.ApplicationName = @Application AND u.ApplicationId = a.ApplicationId))    

Exec dbo.aspnet_Membership_ResetPassword @Application, @UserName, @Password, 10, 10, @PasswordSalt, -5