Optimization of a Web Site - Using Content Expiration (IIS 6.0)


Optimization of a Web Site - Using Content Expiration (IIS 6.0)
 
 
EntLib.com Open Source Team is running the following sites, http://www.EntLib.com, http://forum.EntLib.com and http://blog.EntLib.com . We are always searching for good way to optimize our web sites and make them run better.
 
Many pages on the site have quite a few images and there is a noticeable time lag each time the user navigates across pages, even when the images are being loaded out of the IE cache. Presumably, this was IE sending an "if-modified-since" request to the server and waiting for a 304 response before it served the image from the cache, for each image on the page. Since the images don’t change very often, adding an expires or maxage header to the images would make a very big difference to the users.
 
The following section shows you how to configure and enable Content Expiration in IIS 6.0.
 
Check the following screen shot, then you will know how to configure and Enable Context Expiration. Any questions, please read more about Content Expiration on Using Content Expiration.



 
I thought it applying it on the application, would cause IE to cache my dynamic ASP.NET pages. And it would be a maintenance headache to do this for every image directory in the application, and then remember to do this for every new subdirectory added later.
 
It turns out my assumption was wrong. After a lot of testing, it emerged that IIS is smart enough to add the expiration header only to static content. It automatically adds the header to images and CSS/JS files, without touching the ASPX pages. This is brilliant! This is a great feature that everybody should be using! It has made quite a difference to the user experience for our applications, as now images and CSS files are loaded very quickly straight out of the IE cache.
 
By using httpwatch tool, we will find that static files are retrieved directly from local IE cache, without any 304 response from web server.

 
References:
2. IIS Content expiration header and ASP.NET ,
3. Best practices for creating websites in IIS 6.0,
 

 

发表 @ 2008年11月15日 19:02

打 印
Comments have been closed on this topic.
«九月»
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789