How to Change User's Password with Sitefinity API

by Vesselin Vassilev


Last Updated On Mar 7, 2019


Scenario: you want to change (not reset) a user's password using the Sitefinity API, but all methods (UserManager.ChangePassword() and UserManager.ChangePasswordForUser()) require that you know and provide the old password as a parameter. That's not always possible, so this blog will show you how to do it. 

The trick here is that you first need to *reset* the user's password using the UserManager.ResetPassword() method - it does not require knowing of the old password, it simply generates a new one and assigns it to the user. So, this method will give you the new password which you can then pass to the UserManager.ChangePassword() method as the existing one. 

The below code assumes that you know the Id of the user, e.g. by Querying the user by first name.




Copyright © Sitefinity Development