i can see stackoverflow add's both Expires
and Cache-Control
for their images , css, js etc, so i am trying to do the same, i tried this article
web.config
<location path="Content">
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge"
cacheControlMaxAge="365.00:00:00" />
<clientCache cacheControlMode="UseExpires" httpExpires="Mon, 01 May 2023 00:00:00 GMT" />
</staticContent>
</system.webServer>
</location>
when i try to acess a css file in content folder : http://localhost:11111/Content/bootstrap.min.css
i get the following error
Error:
HTTP Error 500.19 -
Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.
Module CustomErrorModule Notification SendResponse Handler StaticFile Error Code 0x8007000d
Config Error Configuration element 'clientCache' already defined
i know clientCache
already defined, but i am concerned and want to know how to set both Cache-Control and Expires in response headers ?
Any help would be great.
Update:
As @Vitaly Kulikov answered and discussed in comment and using this and this posts i came to conclusion that in IIS we can's set both Expires and Cache-Control
in web.config, so i have planned to use OutputCache to set Expires for images at least and it works with 0.9 milliseconds delay. Hope helps someone.
Cache-Control:public, max-age=60 Expires:Sun, 13 Mar 2016 08:05:18 GMT
how do they do that ? do they do using web.config or they configure in their CDN ? – Buckling