pauliusnrk
pauliusnrk

Reputation: 593

Asp.NET MVC static content caching doesn't work

I want to cache static content of my asp.net mvc 3 app. I added this tag in web.config to cache for 10 days:

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

but it seens doesn't work (checked using YSlow and Fiddler). Any ideas why?

Upvotes: 2

Views: 1872

Answers (1)

driis
driis

Reputation: 164341

Based on the comments we've exchanged above, I'd say that the client side caching works.

Your server sends:

 Cache-Control:max-age=36000

Which means, that the client should cache it for 10 hours (60 * 60 * 10 == 36000). If you actually want 10 days, the configuration is:

cacheControlMaxAge="10.00:00:00" 

Remember that the client might decide to retrieve the resource again regardless of your cache headers, for any number of reasons (such as the client side cache has been purged, the user requested a full refresh, the client doesn't implement client side caching properly, etc. etc.)

How did you arrive at the conclusion that it doesn't work ?

Upvotes: 3

Related Questions