开发者

ASP.NET Cache-Control changes on server

I have ASP.NET MVC action filter that sets the cache-control header of the response. It all works fine except when I publish it to the web server.

When I'm running it through localhost I get the following :

Cache-Control:public, max-age=172800
Connection:Close
Content-Length:15057
Content-Type:application/pdf
Date:Thu, 23 Jun 2011 17:09:09 GMT
Server:ASP.NET Development Server/9.0.0.0
X-AspNet-Version:2.0.50727
X-AspNetMvc-Version:2.0

When running through live site

Cache-Control:public
Content-Length:15057
Content-Type:application/pdf
Date:Thu, 23 Jun 2011 17:09:45 GMT
Server:Microsoft-IIS/6.0
X-AspNet-Version:2.0.50727
X-AspNetMvc-Version:2.0
X-Powered-By:ASP.NET

So for some reason max-age gets cleared out and I can't figure it out.

The only difference I can figure is that the dev site goes thru the Cassini web server and the live is IIS so mayb开发者_高级运维e IIS is clearing out the max-age?

What do I have to do to keep the max-age value in cache-control header?

EDIT: Here's a pic of the system.webserver node in the web.config in case there might be something there to look at.

ASP.NET Cache-Control changes on server


Find and check the <clientCache /> line in your configuration file. Try setting cacheControlMode to UseMaxAge if that is not already the case.

For instance: <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10:00:00" />

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜