iis - ASP.NET and YSlow optimization -
i'm running yslow performance test on small asp.net web project running in iis express. i'm left 2 items think needs optimization.
1. add expires headers
i need set expire date on favicon.ico. how can this?
2. primed cache
when in statistics tab, notice html not cached. how can cache html, 6,7k not downloaded second time? why favicon requsted in primed cache?
favicon:
add web.config file:
<configuration> <location path="favicon.ico"> <system.webserver> <staticcontent> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="90.00:00:00" /> </staticcontent> </system.webserver> </location> </configuration>
html cache:
the browser caches page based on response headers of server response. should ask browser cache page if page contents not change given period of time , user revisit page in given period.
you set cache header using like:
response.cache.setcacheability(httpcacheability.public); response.cache.setmaxage(new timespan(1, 0, 0));
i recommend take @ w3c http cache specifications full overview browser cache.
also, if use cache, browsers ask server if file modified since last time them (the "if-modified-since" header). if file not changed, can respond 304 status code.
Comments
Post a Comment