Base solution for your next web application
Open Closed

How to change the admin password #807


User avatar
0
ofir1234 created

Hi. Is there an easy way to change the admin password via code ? I tried resolving the UserManager and then changing the password for user no 1, like this :

await _userManager.ChangePasswordAsync(1, "123qwe","blabla");

But the password is still the same. So how can I do it ?

Thanks.


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This is the right way actually. Can you get the return value of this method and see if there is an error message ?

    var result = await _userManager.ChangePasswordAsync(1, "123qwe", "blabla");
    
  • User Avatar
    0
    ofir1234 created

    Any other way to change the admin password ? I just need to change it.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you get the result of ChangePasswordAsync method and see if there is an error ?

    var result = await _userManager.ChangePasswordAsync(1, "123qwe","blabla");