In an ASPX page, if you declare <%@ OutputCache Location="Client" Duration="60" VaryByParam="None"%>, the page is correctly cached on the client.If you wish to cache on the client AND the server, you can set <%@ OutputCache Location="ServerAndClient" Duration="60" VaryByParam="None"%>. However this time the "Vary: *" HTTP header is returned to the browser, which invalidates all client caching.It is possible to prevent this, by programmatically adding Response.Cache.SetOmitVaryStar(true); into the Page_Load method, but it would be desirable for the "Vary: *" header not to be emitted by default as you are asking for the page to be cached on the client. The requested behaviour of the Location="ServerAndClient" attribute is being overriden by the inclusion of the "Vary: *" header.It would be nice to either have the "Vary: *" header ommitted by default, or there being the ability to declaratively set the SetOmitVaryStar parameter through the outputCacheProfiles element in web.config.
Version
Please wait...