Output caching in HTTP Handler and SetValidUntilExpires
Posted
by mayor
on Stack Overflow
See other posts from Stack Overflow
or by mayor
Published on 2010-06-08T20:27:19Z
Indexed on
2010/06/08
20:32 UTC
Read the original article
Hit count: 170
.NET
|outputcache
I'm using output caching in my custom HTTP handler in the following way:
public void ProcessRequest(HttpContext context)
{
TimeSpan freshness = new TimeSpan(0, 0, 0, 60);
context.Response.Cache.SetExpires(DateTime.Now.Add(freshness));
context.Response.Cache.SetMaxAge(freshness);
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.Cache.SetValidUntilExpires(true);
...
}
It works, but the problem is that refreshing the page with F5 leads to page regeneration (instead of cache usage) despite of the last codeline:
context.Response.Cache.SetValidUntilExpires(true);
Any suggestions?
© Stack Overflow or respective owner