注销后如何阻止用户使用后退病房页面 [英] how to stop the user to use back ward page after log out

查看:88
本文介绍了注销后如何阻止用户使用后退病房页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

点击退出按钮后用户不能返回上一页



即时使用

 formsauthentication.signout()





但仍允许返回上一页..

解决方案

< blockquote>我更喜欢 no-cache expires 指令。用户仍然可以单击后退按钮,浏览器将尝试导航到相应的页面,但是再次从服务器请求它,而不是从缓存中检索它。现在你的服务器应该将他重定向到适当的页面(例如登录页面)。


 function noBack(){window.history.forward(); } 
noBack();
window.onload = noBack;
window.onpageshow = function(evt){ if (evt.persisted)noBack(); }
window.onunload = function(){ void 0 ); }





试试这个......放在合适的页面中


after clicking on logout button user should not able to go back to previous page

im using

formsauthentication.signout()



but still it is allowing to go back to previous page..

解决方案

I''d prefer the no-cache and expires directives. The user could still click the back button, and the browser would try to navigate to the respective page, but request it again from the server instead of retrieving it from the cache. And now your server ought to redirect him to an appropriate page (e.g. login page).


function noBack() { window.history.forward(); }
    noBack();
    window.onload = noBack;
    window.onpageshow = function (evt) { if (evt.persisted) noBack(); }
    window.onunload = function () { void (0); }



try this... place in an appropriate page


这篇关于注销后如何阻止用户使用后退病房页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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