I am working on an ASP.NET Core 6.0 Identity project. I want to pass an ApplicationUser object to the LoginWith2fs.cshtml page from the Login.cshtml page.
This is my code - login page:
return RedirectToPage("./LoginWith2fa", new
{
UserSent = user,
ReturnUrl = returnUrl,
RememberMe = Input.RememberMe
});
Code in LoginWith2fa page:
// Created this property in the LoginWith2fa page. Not sure this is needed or not
public ApplicationUser UserSent { get; set; }
public async Task<IActionResult> OnGetAsync(ApplicationUser UserSent, bool rememberMe, string returnUrl = null)
{
// More code here
// the ApplicationUser object has null values in its properties such as username and email
// However the rememberMe and returnUrl variables have correct values
}