Home Dashboard Directory Help
Search

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


Status: 

Closed
 as Fixed Help for as Fixed


0
0
Sign in
to vote
Type: Bug
ID: 254940
Opened: 1/31/2007 9:45:35 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

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.
Details
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!
Sign in to post a workaround.