Reputation: 3275
Asp.net is able to cache pages using the OutputCache directive. Is it is possible to remove a page from the cache if a postback occurs? I have tried using RemoveOutputCacheItem(Absolute Page path) in Page_load with the IsPostback conditional and although the code runs the page stubbornly stays in the cache.
Any ideas on how to clear a page from cache?
Upvotes: 1
Views: 799
Reputation: 550
Try:
if (IsPostBack)
{
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1500;
Response.CacheControl = "no-cache";
}
Upvotes: 1