User283571144 posted
Hi JAYHAWKER,
I see there is a "reset password" command, and even one that allows you to change it if you know it. But how can I change it if I don't know it?
According to your description, I suggest you could use UserManager's RemovePassword method remove password firstly.
Then you could use UserManager's AddPassword add it.
More details, you could refer to follow codes and link:
var userId = System.Web.HttpContext.Current.User.Identity.GetUserId();
if (userId != null)
{
UserManager<IdentityUser> userManager =
new UserManager<IdentityUser>(new UserStore<IdentityUser>());
userManager.RemovePassword(userId);
String newPassword = "aaaaaaa";
userManager.AddPassword(userId, newPassword);
}
Link:
UserManager's RemovePassword: https://msdn.microsoft.com/en-us/library/dn497511(v=vs.108).aspx
UserManager's AddPassword: https://msdn.microsoft.com/en-us/library/dn497465(v=vs.108).aspx
Best Regards,
Brando