开发者

How do I make sure that a website is loaded NOT from cache

开发者 https://www.devze.com 2023-01-23 01:12 出处:网络
My website homepage suupose to look different every time a user loads it. However, it loads from memory thus looks the same every time.

My website homepage suupose to look different every time a user loads it. However, it loads from memory thus looks the same every time.

How can i make sure that it loads the new page and not the cached page?

开发者_如何学运维

Thanks


protected void Page_Load(object sender, EventArgs e)
{

 Response.Cache.SetCacheability(HttpCacheability.NoCache);
}

in your code behind.


set your request header for caching with Cache-Control: no-cache and response headers as Pragma: no-cache. and expires:


Do you want to that programmatically or not?

Yes - Send HTTP headers that are about cache-control and expires.

No - Press shift before clicking the refresh button...this is to perform a hard reload.

0

精彩评论

暂无评论...
验证码 换一张
取 消