ASP.Net MVC 5W /身份2.2.0注销不工作 [英] ASP.Net MVC 5 w/identity 2.2.0 Log off not working

查看:184
本文介绍了ASP.Net MVC 5W /身份2.2.0注销不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的测试ASP.Net MVC 5站点(Internet站点),一个基本的登录。

I am using a the basic login on a test ASP.Net MVC 5 site (for an internet site).

登录工作正常,但是当我尝试注销它不会发生。
注销链接并调用下面的控制器动作:

The login works fine but when I try to logout it doesn't happen. The logout link does call the following controller action:

public ActionResult LogOff()
{
    AuthenticationManager.SignOut();
    return RedirectToAction("Index", "Home");
}

不过,用户保持登录状态。我如何确保用户实际获得退出?

But the user stays logged in. How do I ensure that the user actually gets logged out?

推荐答案

我以前有这个问题,更改:

I had this problem before, change:

AuthenticationManager.SignOut();

要:

AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

假设你正在使用的 ApplicationCookie 以保存您的登录信息。

Assuming that you are using ApplicationCookie to store your login information.

这篇关于ASP.Net MVC 5W /身份2.2.0注销不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆