Output caching in HTTP Handler and SetValidUntilExpires
- by mayor
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?