簡體   English   中英

asp.net中的向后按鈕,顯示IE11中的歷史記錄

[英]back button in asp.net showing history in IE11

我下面的代碼在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);

在您的主頁上使用此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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM