Anti-Forgery Token was meant for a different claims-based user

前端 未结 7 1758
有刺的猬
有刺的猬 2020-12-28 13:41

I am working on a logout feature in the application we are using ASP.NET Identity login. I can login successfully but when I logout and then try to login again I get the fol

7条回答
  •  时光说笑
    2020-12-28 14:18

    You are returning a View, rather than calling RedirectToAction(). So what is happening is the view is running under the context of the logout request, where the user is still logged in. They won't be logged out until the request finishes.

    So, try

    public ActionResult Logout()
    {
        SignInManager.Logout();
        return RedirectToAction("Index", "Home");
    }
    

提交回复
热议问题