FormsAuthentication.SignOut() 后,并未真正退出的原因
2017-07-10 14:11
295 查看
使用Asp.net开发,使用Forms验证,在退出按钮里写 FormsAuthentication.SignOut() 并清除Session和Cookie,发现退出后,使用Request.IsAuthenticated获取到的值依然是True。
解决办法:
FormsAuthentication.SignOut() 必须写在逻辑最后,在执行FormsAuthentication.SignOut()方法后,不能再进行清除Cookie的操作。
或者写入session清除更明了有效。
public ActionResultLogout()
{
FormsAuthentication.SignOut();
Session.RemoveAll();
}
参考文章http://demo.tc/Post/700
解决办法:
FormsAuthentication.SignOut() 必须写在逻辑最后,在执行FormsAuthentication.SignOut()方法后,不能再进行清除Cookie的操作。
或者写入session清除更明了有效。
public ActionResultLogout()
{
FormsAuthentication.SignOut();
Session.RemoveAll();
}
参考文章http://demo.tc/Post/700
相关文章推荐
- FormsAuthentication.SignOut() 后,并未真正退出的原因
- FormsAuthentication.SignOut(); FormsAuthentication.SetAuthCookie(u.UserName, false);
- FormsAuthentication.Signout不能清楚服务器端cookie
- FormsAuthentication.SignOut()问题
- FormsAuthentication.SignOut() 会删除所有登录凭证
- CAS 3.4 单点退出详细配置(Configuring Single Sign Out )
- FormsAuthentication.Authenticate()方法总是返回false的原因
- rails 4 + devise 3.1.0 中退出登录出现 No route matches [GET] "/users/sign_out" 错误
- AuthenticationManager.SignOut() 无法注销用户的问题
- (原创)在web应用中部署单点退出Single Sign Out
- google退出中国的真正原因
- CAS 3.4 单点退出详细配置(Configuring Single Sign Out )
- IAuthenticationManager.SignOut 退不了
- 再次遇到OutOfMemoryError(新的原因造成)
- pat甲级1006-Sign In and Sign Out
- 联合国为周恩来降半旗的真正原因!
- 对话框中WaitForSingleObject等待线程退出导致程序阻塞的原因及解决
- PAT(A) - 1006. Sign In and Sign Out (25)
- Debug下正常,而Release失败的真正原因
- 1006. Sign In and Sign Out