Asp.net mvc AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationOkie)时HttpContext.Current.Session是否会被销毁;

Asp.net mvc AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationOkie)时HttpContext.Current.Session是否会被销毁;,asp.net-mvc,Asp.net Mvc,我有HttpContext.Current.Session[“CurrentUser”]=user在我的代码和注销中的某个地方,我有这个 public ActionResult LogOff() { AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); return RedirectToAction("Index", "Home"); } 我只想确保

我有
HttpContext.Current.Session[“CurrentUser”]=user在我的代码和注销中的某个地方,我有这个

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

我只想确保在我注销时,HttpContext.Current.Session
也被解除锁定。如果没有,那么它如何销毁它呢?

我认为服务器默认情况下会保留
会话
数据20分钟,除非您做一些明确的操作

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

有关更多信息,请参见此处:

建议在注销后调用会话
放弃()。请参阅链接中的第三个注释。