ASP.Net MVC 5 w/identity 2.2.0 注销不起作用 [英] ASP.Net MVC 5 w/identity 2.2.0 Log off not working

查看:34
本文介绍了ASP.Net MVC 5 w/identity 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 5 w/identity 2.2.0 注销不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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