How to Leverage browser caching at ASP.net IIS 7.5

MonsterMMORPG picture MonsterMMORPG · Jul 9, 2011 · Viewed 29.8k times · Source

The following cacheable resources have a short freshness lifetime. Specify an expiry of at least one week in the future for the following resources:

http://pagespeed.googlelabs.com suggest me this for my website as a high priority. I am using windows server 2008 r2 netframework 4.0 asp.net IIS 7.5 . How do i do this ?

This is the direct url for you to see : http://pagespeed.googlelabs.com/#url=www.monstermmorpg.com&mobile=false&rule=LeverageBrowserCaching

Answer

Nikita Ignatov picture Nikita Ignatov · Jul 9, 2011

You might start here with this article, also Mads Kristensen had written an interesting blog post on how to compress, minify and cache dynamic and static content on your website.

<configuration> 
 <location path="showStockPrice.asp">     
   <system.webserver>        
     <caching>         
       <profiles>
         <add varybyquerystring="*"location="Any"
           duration="00:00:01" policy="CacheForTimePeriod"            
           extension=".asp">
       </profiles>
     </caching>
   </system.webserver>
 </location>

To cache static content

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