Pages

làm thế nào thay đổi mật khẩu trong aspnet_Membership database

If you want to change the password directly through the database, you are going to need to create a new user or find an existing user that you know the password of. Then, you'll need to get the password and salt, then update the user in question with the same password and salt.


Get the user's password/salt:
SELECT 
    au.username, aa.ApplicationName, password, passwordformat, passwordsalt
FROM 
    aspnet_membership am
INNER JOIN 
    aspnet_users au ON (au.userid = am.userid)
INNER JOIN 
    aspnet_applications aa ON (au.applicationId = aa.applicationid)
WHERE
    au.UserName = '[user to change password]'
Change the password:
DECLARE @changeDate DATETIME
SET @changeDate = GETDATE()

EXEC aspnet_Membership_setPassword 
    'applicationName',
    'user',
    'password',
    'passwordsalt',
    @changeDate,
    Passwordformat

Không có nhận xét nào :

Đăng nhận xét