简体   繁体   中英

ASP.NET MVC: OutputCache and http headers - Cache-Control

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" (ie proxies - see http://msdn.microsoft.com/en-us/library/system.web.httpcacheability.aspx ).

Any ideas?

Cheers Anthony

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM