I checked with link it accept the user.ID in string return. this was working in asp.net core 2.2
I am using asp.net core 6.
The problem find out when link converts on Get Method of ResetPassword - It decode properly and on Post Method It will get change back to encoded format. I don't know ? and I also pass it into model for view.
So the fix is, I Decode it on Post Method So It's working for me .
[HttpPost]
public async Task<IActionResult> ResetPassword(ResetPasswordViewModel input)
{
if (!ModelState.IsValid)
{
return View();
}
var user = await _userManager.FindByEmailAsync(input.Email);
if (user == null)
{
// Don't reveal that the user does not exist
return RedirectToAction(nameof(ResetPasswordConfirmation));
}
var result = await _userManager.ResetPasswordAsync(user, Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(input.Code)), input.Password);
if (result.Succeeded)
{
return RedirectToAction(nameof(ResetPasswordConfirmation));
}
foreach (var error in result.Errors)
{
ModelState.AddModelError(string.Empty, error.Description);
}
return View(input);
}