2012-05-10 43 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