문제

I have a logout in my mastrpage.page_load in which I disable the cache like so:

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

Response.Redirect("Login.aspx");

The logout functionalitly works fine if the page gets refreshed and you are logged out, you go to the login page. But if you logout and hit back button, you can still go to the previous page.

How do I fix this from happening?

도움이 되었습니까?

해결책

You can try this in Page_Load event.

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

For mor information you can read this. Setting the Cacheability of a Page

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top