I have this test account that is saved in AspNetUsers (with password), AspNetRoles and AspNetUserRoles. What I want is to login this account using only the UserName (without a password).
I tried using the SignInManager.SignInAsync() but I failed when it redirects to a page with Authorize attribute, it seems that it does not authenticate the user.
public ActionResult Confirmation(string userName)
{
var user = UserManager.FindByName(userName);
SignInManager.SignInAsync(user, true, true);
return RedirectToAction("Action", "Controller");
}
[Authorize(Roles = "Member")]
public ActionResult Action()
{
// do something
}
How to do this correctly?