Last active
November 20, 2017 11:02
-
-
Save devseevali/183869d3c5a45e92c8cd3f9b02d31da1 to your computer and use it in GitHub Desktop.
Sql Server Membership User: Unlock and Change Password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Unlock User | |
DECLARE @return_value int | |
EXEC @return_value = aspnet_Membership_UnlockUser | |
@ApplicationName = '/', | |
@UserName = 'user_name' | |
SELECT 'Return Value' = @return_value | |
GO | |
--Get required details using another known User | |
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 = 'other_user_name'; | |
-- Change Password | |
DECLARE @changeDate DATETIME | |
SET @changeDate = GETDATE() | |
EXEC aspnet_Membership_setPassword | |
'applicationName', | |
'user_name', | |
'other_user_password', | |
'other_user_password_salt', | |
@changeDate, | |
other_user_passwordformat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment