开发者

set cache-control in asp.net

开发者 https://www.devze.com 2023-03-13 03:46 出处:网络
How can I set cache-control to \"no-cache,no-store\" in ASP.NET? Do I have to implement a cache module whic开发者_StackOverflow社区h caches every response, or can it be done using OutputCache in ASPX

How can I set cache-control to "no-cache,no-store" in ASP.NET? Do I have to implement a cache module whic开发者_StackOverflow社区h caches every response, or can it be done using OutputCache in ASPX page itself?


Response.CacheControl = "no-cache";

Response.AddHeader("Pragma", "no-cache");

Response.AddHeader("Pragma", "no-store");

Response.AddHeader("cache-control", "no-cache");

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.Cache.SetNoServerCaching();
0

精彩评论

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