Caching is a very easy solution to many performance related issues on almost any website. There are many different ways to use server-side caching and they all have their own unique advantages. But client-side caching is often ignored in the .NET blogosphere even though it is just as important as the server-side cache.

Everywhere server-side caching is used you can and should use client-side caching as well. Even though the server can serve cached ASP.NET pages very fast it still rely on the browser to download and render the output. When adding client-side caching you get an enormous performance benefit when the page is visited more than once by the same browser.

Firefox and IE6/7 has a slightly different way of interpret client-side caching, so you have to implement it correct to get it to work in both browsers. Here is an example of a method that caches the page on the client based on a date. The date should be the exact date of the last time the content changed.

private void SetClientCaching(DateTime lastModified)

{

  Response.Cache.SetETag(lastModified.Ticks.ToString());

  Response.Cache.SetLastModified(lastModified);

  Response.Cache.SetCacheability(HttpCacheability.Public);

  Response.Cache.SetMaxAge(new TimeSpan(7, 0, 0, 0));

  Response.Cache.SetSlidingExpiration(true);

}

> >>>

>

>

If you use a HTTP Handler (.ashx) or some other means to serve files – it could be XML-files – it could be a good idea to do a server-side caching as well. Here’s a method you can call that does just that:

private void SetFileCaching(string fileName)

{

  Response.AddFileDependency(fileName);

  Response.Cache.SetETagFromFileDependencies();

  Response.Cache.SetLastModifiedFromFileDependencies();

  Response.Cache.SetCacheability(HttpCacheability.Public);

  Response.Cache.SetMaxAge(new TimeSpan(7, 0, 0, 0));

  Response.Cache.SetSlidingExpiration(true);

}

>>

You could use the same method to do standard output caching including client-side caching. >

SetFileCaching(Request.PhysicalPath);

That makes it more powerful than the regular output cache, because it provides client-side caching as well. As mentioned before, there are a lot of ways to use the different kinds of caching and they all bring something to the plate. The code in this example is something I use all the time because it works great for the projects I work on. In the end it is a personal choice.

IE 7 final will be released very soon, but already now you can download it. The final version number is 7.0.5730.11. It doesn’t appear to be much different from the last beta. I've just downloaded it and the installation went seamless with no problems from my antivirus program or anything else of the sort.

This means that it now is time for all you web developers to make sure that your website(s) will look great in IE 7. My experiences are a bit mixed, because there are subtile differences that makes the rendering in IE 7 different from both Firefox and Opera. That can lead to some severe issues in your HTML, CSS and JavaScript.

IE 7 final will be released through Windows Update at November 1.

Update thursday, October 19.

Now it is relaesed officially through the Internet Explorer website.