3

I have just started using OutputCache on some of my controller actions and I am not quite getting the response I would expect.

Basically I have set Location = OutputCacheLocation.Any and the http header is as follows:

Server              ASP.NET Development Server/9.0.0.0
Date                Wed, 15 Jul 2009 02:14:21 GMT
X-AspNet-Version    2.0.50727
X-AspNetMvc-Version 1.0
Content-Encoding    gzip
Cache-Control       private, max-age=3600
Expires             Wed, 15 Jul 2009 02:14:21 GMT
Last-Modified       Wed, 15 Jul 2009 02:14:20 GMT
Vary                *
Content-Type        text/html; charset=utf-8
Content-Length      640
Connection          Close

Now if my interpretation is correct the Cache-Control part being set to private means that it will only be cached on the client. I need to also be cached on any proxy.

I would have expected that by setting OutputCacheLocation.Any the Cache-Control would have been something like "public, max-age=3600". As far as I know the private means it will only be cached on the client and not by "Any" (i.e. proxies - see http://msdn.microsoft.com/en-us/library/system.web.httpcacheability.aspx).

Any ideas?

Cheers Anthony

3
  • Have you tried publishing your site to IIS and looking at the headers there? Is it the same as on the dev server? Commented Jul 15, 2009 at 2:39
  • No i have only tried within VS atm. Do you imagine that there would be a difference? Commented Jul 15, 2009 at 3:22
  • When i put it up on the test site, it went to public. Commented Jul 15, 2009 at 7:03

1 Answer 1

1

See comments above for solution

EDIT

This comment was deemed the answer:

Have you tried publishing your site to IIS and looking at the headers there? Is it the same as on the dev server? –

Sign up to request clarification or add additional context in comments.

3 Comments

@Rock: The OP gets no rep for answering their own question.
ah, good call. I didn't look to see who was asking the question. Still shouldn't be a valid "Answer" in the SO archives.
I thinks its valid. I don't care who gets the points but from the looks of it (see view count) other have had the same issue and this has helped. If you want to pull out the comment from @womp I will accept that as the answer. Not my fault he answered the way he did.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.