c# - ASP.NET MVC Response.Cache VaryByHeaders -
i have controller delivers response , trying set cache shown below,
if(string.equals( request.query["cached"] , "true", cultureinfo.ignorecase)){ response.cache.setcacheability(httpcacheability.private); response.cache.setmaxage(timespan.fromdays(1)); response.cache.varybyheaders["cookie"] = true; }
when see response in chrome, see header,
cache-control: private, max-age=86400 vary: accept-encoding
vary header default, , changing.
i not want use outputcache because cache enabled querystring parameter cached=true. when using asp.net mvc 4, used see response
vary:*
and have upgraded project asp.net mvc 5, no longer working. want response cached @ browser (client) based on login , cookies.
since december 2013 may able activate iis dynamic compression without compromising vary header. depending on os version, may need apply hotfix.
see following kb hotfix. http://support.microsoft.com/kb/2877816
this information founded on https://stackoverflow.com/a/11156510/1178314
Comments
Post a Comment