Trying to keep user from using an old password for their new one
<p>I am trying to prevent the user from using any of their last 5 passwords. I am using the exact template from Visual Studio 2015 that gives you a basic Identity user system with it.</p>

<p>I have went ahead to add the following columns to my user database, passwordLastChanged(Date) and 5 columns named previousPassword1 (through 5) respectively.</p>

<p>I need to retreive the current user password from the database using something along the lines of <code>User.Identity.GetUserPassword</code> and I also need something along the lines of  <code>model.NewPassword.Encrypt</code> (those don't exist!). Are there methods that do these actions that I am just not seeing in the api?</p>

<p>And I also have to encrypt my new data to see if it matches, how can I encrypt a string the same way that my user password is encrypted?</p>

<pre><code>//
// POST: /Manage/ChangePassword
[HttpPost]
[ValidateAntiForgeryToken]
public async Task&lt;ActionResult&gt; ChangePassword(ChangePasswordViewModel model)
{
    if (!ModelState.IsValid)
    {
        return View(model);
    }
    var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);
    if (result.Succeeded)
    {
        var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
        if (user != null)
        {
            await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
        }
        return RedirectToAction("Index", new { Message = ManageMessageId.ChangePasswordSuccess });
    }
    AddErrors(result);
    return View(model);
}
</code></pre>