具有后退按钮问题的网站注销代码 [英] Logout code for website with back button issue

查看:58
本文介绍了具有后退按钮问题的网站注销代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii任何人都可以告诉我网络应用的注销代码。我正在注销,但是当我点击浏览器的后退按钮时,它再次显示后页。如何删除..Thnxx ..

Hii any one can tell me logout code for web applicatio. i am doing logout but when i click on Back button of browser then It shows back page again. How can i remove..Thnxx..

推荐答案

protected void btnlogout_Click(object sender, EventArgs e)
       {
           Session.Abandon();
           Session.Clear();
           Response.Redirect("LoginPage.aspx");
       }


另一张海报是对的。您无法停止后退按钮的工作。您在网络上找到的解决方案很容易被黑客入侵。您所能做的就是编写代码来记录用户,并将您的页面标记为不缓存,以便在用户尝试返回时重新加载(然后转到您的登录页面)。



http://www.htmlgoodies.com/beyond/reference/ article.php / 3472881 [ ^ ]
The other poster is right. You CANNOT stop the back button working. Solutions you find on the web, are easily hacked. All you can do, is write code to log the user out, and mark your pages to not be cached, so that they reload when the user tries to go back ( and thus go to your login page ).

http://www.htmlgoodies.com/beyond/reference/article.php/3472881[^]


在您的注销码中使用此代码





Use this code in your logout code


Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();


这篇关于具有后退按钮问题的网站注销代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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