2013-03-30 52 views

回答

1

因为它是从缓存中获取页面,所以您可能希望为这些相应的页面禁用缓存。

有些人要求禁用后退按钮,因此无法禁用后退按钮。替代方案是:

  • 防止缓存那些页面
  • 从回去一次用户退出应用程序的阻止用户。

对于第二种情况,请查看以下代码并将其放入您的登录页面。

<script type = "text/javascript" > 
function changeHashOnLoad() { 
window.location.href += "#"; 
setTimeout("changeHashAgain()", "50"); 
} 

function changeHashAgain() { 
window.location.href += "1"; 
} 

var storedHash = window.location.hash; 
window.setInterval(function() { 
if (window.location.hash != storedHash) { 
    window.location.hash = storedHash; 
} 
}, 50); 


</script> 

,并调用它象下面这样:

<body onload="changeHashOnLoad(); "> 
//---Rest of your code 

它会在所有的浏览器。

来源:SO(没有链接到原来的线程)

0

您可以使用像使用如下

FormsAuthentication.SignOut(); 
Session.Abandon(); 

// clear authentication cookie 
HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, ""); 
cookie1.Expires = DateTime.Now.AddYears(-1); 
Response.Cookies.Add(cookie1); 

// clear session cookie (not necessary for your current problem but i would recommend you do it anyway) 

HttpCookie cookie2 = new HttpCookie("ASP.NET_SessionId", ""); 
cookie2.Expires = DateTime.Now.AddYears(-1); 
Response.Cookies.Add(cookie2); 

FormsAuthentication.RedirectToLoginPage(); 
相关问题