如何不允许用户使用浏览器的『后退按钮』查看前面缓存下来的页面

告诉你一个简单的办法,写一个页面基类:  
 
public  class  PageBase  :  Page  
{  
     public  PageBase()  {}  
 
     protected  override  OnLoad(  EventArgs  e  )  {  
             Response.Cache.SetNoStore();  
             base.OnLoad();  
     }  
}  
 
然后把所有的页面从这个页面继承,查找替换就行了  
 
或者在Global里面:  
protected  void  Application_BeginRequest(Object  sender,  EventArgs  e)  
{  
       HttpContext.Current.Response.Cache.SetNoStore();  
}
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>  
发布了29 篇原创文章 · 获赞 0 · 访问量 13万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章