The ServerAndClient parameter with the OutputCache page directive does not cache on the client, without code - by AndyAtBeckbury

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


0
0
Sign in
to vote
ID 254940 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/31/2007 9:45:35 AM
Access Restriction Public

Description

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.
Sign in to post a comment.
Posted by Microsoft on 9/12/2008 at 10:17 AM
The next major version of the .NET Framework will no longer emit the "Vary:*" header when the @OutputCache directive's Location attribute is set to ServerAndClient.

Thank you for using Connect!
Posted by Microsoft on 2/12/2007 at 6:13 PM
Since there is currently a workaround, we need to defer fixes for this issue until a future major release. However we will document the workaround in a Knowledge Base article.

Thank you for submitting this bug!