Question

I have this system.webServer section. When I add the clientCache line, the web server stops serving JavaScript, CSS, and images. When I remove the clientCache line, it again starts serving them. What is wrong with my clientCache element?

This problem occurs both in the Visual Studio development server and when I push the Website to Azure.

<system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="86400"/>
    </staticContent>
    <!--Handlers removed for clarity-->
</system.webServer>
Was it helpful?

Solution

In ASP.NET, the clientCache > cacheControlMaxAge property is a timespan (though the HTTP specification makes its max-age header seconds.)

So, this is wrong:

<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="86400"/>

And this is right:

<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00"/>

Where was the ISO on this one?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top