2012-05-10 36 views
1

我在mastrpage.page_load注销在我禁用缓存,像这样:无缓存和注销在C#/ asp.Net 3.5

Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d); 
Response.Expires =-1500; 
Response.CacheControl = "no-cache"; 

Response.Redirect("Login.aspx"); 

如果页面被刷新注销functionalitly工作正常,你已经注销,你去登录页面。但是,如果您注销并按回按钮,则仍然可以转至上一页。

如何解决这个问题?

回答

1

您可以在Page_Load事件中尝试此操作。

Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); 
Page.Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1)); 
Page.Response.Cache.SetNoStore(); 

对于mor信息,你可以阅读这个。 Setting the Cacheability of a Page

+0

谢谢我没有缓存,它仍然没有工作,但我会检查链接中的笔记 – cdub

+0

@chris:请参阅我的更新的答案。 – jams

+0

@chris:这也是一个很好的阅读http://stackoverflow.com/questions/10525172/what-is-different-between-httpcacheability-nocache-and-response-cachecontrol – jams