后退按钮Web浏览器中的会话问题 [英] session problem in back button web browser
本文介绍了后退按钮Web浏览器中的会话问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网络应用程序有问题..
我使用会话登录表单,然后按注销按钮时,会话停止.
但是当我在Web浏览器中按返回按钮时,以前的数据无法清除..
i have some problem with my webaplication..
i have form login with session and then when i press logout button, session is stop.
but when i press back button in web browser, previous data not clear..
can you help me if i press back button and the session is end, the page will redirect to main webform...?
推荐答案
您需要强制缓存以:有效期到期.
试试这个:
You need to force the cache to expire for this to work.
Try this:
Page.Response.Cache.SetCacheability(HttpCacheability.NoCache)
或
在后面的代码中使用它
Or
Use it in code behind
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoServerCaching();
HttpContext.Current.Response.Cache.SetNoStore();
Session.Abandon();
aspx页面
aspx page
<script type="text/javascript" language="javascript">
window.history.forward(1);
document.attachEvent("onkeydown", my_onkeydown_handler);
function my_onkeydown_handler()
{
switch (event.keyCode)
{
case 116 : // F5;
event.returnValue = false;
event.keyCode = 0;
window.status = "We have disabled F5";
break;
}
}
</script>
或
请参阅:注销后浏览器后退按钮问题 [
Or
Refer: Browser back button issue after logout[^]
This article describes detailed information about how to stop user from accessing the previous pages once he/she logs out and presses browser back button.
您使用会话还是cookie?
如果使用会话,请确保使用Session("username")= null; Session.Abandon();
Do you use session or cookie?
if use session, please make sure that you use Session("username")=null; Session.Abandon();
这篇关于后退按钮Web浏览器中的会话问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文