facebook
facebook

Reputation: 1864

set cache-control in asp.net

How can I set cache-control to "no-cache,no-store" in ASP.NET? Do I have to implement a cache module which caches every response, or can it be done using OutputCache in ASPX page itself?

Upvotes: 0

Views: 710

Answers (1)

Saurabh
Saurabh

Reputation: 5727

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();

Upvotes: 1

Related Questions