如何禁用浏览器后退按钮??? [英] how to disable browser back button???

查看:72
本文介绍了如何禁用浏览器后退按钮???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在用户注销时禁用浏览器后退按钮的方法...
我出于安全目的使用了会话,并在注销时销毁了会话..
一切工作正常,除了以下情况:如果在我们单击注销之前的页面是POSTBACK页面,则在单​​击浏览器后退按钮时它将显示最后访问的页面..
我也用过window.history.(向前或向后),但不起作用...
甚至我都破坏了页面的缓存..
但是当页面回发时我无法销毁..
因为即使用户仍然登录,它也会显示消息页面已过期" ...
我想在浏览器后退按钮上触发页面加载事件,以便它会检查页面加载时的会话状态,并将其重定向回登录页面...
这个朋友有什么解决办法吗???
我想要C#(网络开发)中的代码.
谢谢:)
tc all

i want to know waz the way to disable the browser back button when user logout...
i have used session for security purposes and im destroying session at logout..
everything is working perfectly except the thing that if the page before we click logout is a POSTBACK page, then on clicking the browser back button it shows the last visited page..
i have also used window.history.(forward or back) but does n''t work...
and even i have distroyed the cache of the page is well..
but i cant destroy when page postbacks..
because as it wud show the message "the page has expired" even when the user is still logged in...
i want to fire the page load event on browser back button so that it wud check the session state on page load and it wud redirect back to login page...
any solution for this friends????
i want the code in c# (web devolpment).
thanks :)
tc all

推荐答案

在Google上进行搜索后,此
Search on google threw this up[^].


您可以使用
关闭所有页面的缓存
You can turn off caching for all your pages, with
Response.Cache.SetCacheability(HttpCacheability.NoCache). 



您还可以执行以下操作:



You can also do something like:

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


这篇关于如何禁用浏览器后退按钮???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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