asp.net中显示IE11历史的后退按钮

本文关键字:按钮 历史 IE11 net 显示 asp | 更新日期: 2023-09-27 18:29:13

我下面的代码在Firefox和chrome中运行良好。但当我在IE 11中打开网站并登录后,我按下注销按钮,然后按下后退按钮,我以前的数据(历史页面)就会出现。如何在IE11中解决此问题。

我的注销按钮代码在之后

// Code disables caching by browser. Hence the back browser button
// grayed out and could not causes the Page_Load event to fire 
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
Response.Redirect("~/main.aspx);

asp.net中显示IE11历史的后退按钮

在主页上使用此javascript,禁用浏览器的历史记录

<script type = "text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
</script>

只需在Page_Load()中添加一行代码:

Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);