在AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie)时,HttpContext.Current.Session是否被销毁?

时间:2017-02-18 03:04:31

标签: asp.net-mvc

我的代码中有HttpContext.Current.Session["CurrentUser"] = user;,注销时我有

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

我只是想确保在我注销时HttpContext.Current.Session也被破坏了。如果没有那么它是如何破坏它的?

1 个答案:

答案 0 :(得分:1)

我认为默认情况下服务器将保留{{1}}数据20分钟,除非您做了明确的事情。

但是您可以在注销时清除特定的Session变量或放弃会话。

有关详细信息,请参阅此处:What is the difference between Session.Abandon() and Session.Clear()

相关问题