表单身份验证登出 [英] form authentication signout

查看:133
本文介绍了表单身份验证登出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FormsAuthentication.SignOut();
        Session.Clear();
        Response.Redirect("login.aspx", true);




此代码不会杀死cookie.当我回去.用户仍处于登录状态..




this code is not killing the cookie. when i go back. user is still loged in.. what is the problem

推荐答案

hi,

您仅清除会话变量就不会使用该语句杀死cookie.

这足以避免输入未登录的人员.
如果您单击后退"按钮,则会在浏览器中显示以前的页面,但注销后用户无法对这些页面执行任何操作.

如果您想清除Cookie,则必须将Cookie的到期时间设置为-1,例如



cookies are not killed by using that statement you just clearing session variables.

that is enough for avoid entering unloggedin persons.
offcourse the previous pages are shown in browser if you click on back button but user can''t do anything with those pages after logged out.

If you want to clear cookies you''ve to set cookie expiretime to -1 like

 Response.Cookies[0].Expires.AddDays(-1);
Response.redirect("login.aspx");



上面的代码将杀死与该网站有关的所有cookie.


希望你能理解我的意思



the above code ''ll kill all cookies regarding that website.


I hope u''ll understand what I said


这篇关于表单身份验证登出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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