I recently had to come up with a good argument for upgrading a Windows Server 2003 to Windows 2008 R2. It is used as a web server, so the benefit I was looking for was the upgrade of IIS 6 to IIS 7.5.

So I thought, why not make two deploys of the exact same website to both server editions and compare the performance. It so happens to be that there are many performance comparison articles about this floating around, but no one addressed the client-side aspect of the performance differences.

I’d already prepared the <system.webServer> section of the web.config with various performance tricks for IIS 7. Of course, IIS 6 ignores the <system.webServer> section and therefore don’t get any of the performance enhancements.

I’ve recorded the performance using YSlow and here is what the result looks like:

IIS 6 vs. IIS 7
Click for larger image

The reason for the slightly different file sizes is due to the compression level of the native IIS 7 compression and my custom compression library. The interesting part is when the browser’s cache is primed. That means when the visitor has visited the website before.

It should be noted that it is indeed possible to achieve the same performance metrics using IIS 6, but then you either need to add custom HTTP handlers or write to the IIS 6 metabase.

Here are the performance optimization tricks I used.


I’ve used Google’s Page Speed plug-in for Firebug a lot since it was released last year. Even though it’s not as good as Yahoo’s YSlow plug-in, it’s still very usable for some scenarios YSlow doesn’t support – my favorite being the analysis of unused CSS and selector optimizations.

It also has a feature that will tell you how much your web page will gain by minifying the HTML.

Not only does it analyze the difference but it can also generate an optimized version of your HTML. It removes unnecessary whitespace which in most cases are pretty harmless. But, it does more than that. It actually strips out attribute quotes from the HTML elements as well as remove the closing </body> and </html> tags. This renders the entire page invalid according to any WC3 (X)HTML standards. 

Even though it is a good idea to minify your HTML, this feature of the Page Speed plug-in makes it completely useless to me. Unless you’re Google, Twitter or Facebook, this feature is just strange.


At the Mix10 conference, the Windows Phone 7 teams had some very big announcements – a lot of it had been kept secret and first revealed to the public now. There is however still some details they keep secret. Some of these secrets are the user agents of Internet Explorer for Windows Phone 7, which they simply wouldn’t give us.

After playing with Windows Phone 7 we managed to secure a copy of the user agent string. The user agent for IE on Windows Phone 7 running on the Asus Galaxy device is:

Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) Asus;Galaxy6

Notice that it identifies the browser as IE7 and the operating system as Windows Phone OS 7. The IE team told us that the browser in Windows Phone 7 is a mobile version of IE7 with certain features ported from IE8. So it doesn’t use the full Trident 4 layout engine that IE8 uses, but instead Trident version 3.1 with a few extra capabilities.

The user agent was retrieved from server logs, so it is the actual user agent from the actual browser.


A few weeks back i found out that the method I use to minify CSS was about 5% more efficient than the YUI Compressor. I tweeted about it and was encouraged to post the code that does the actual minification.

public static string RemoveWhiteSpaceFromStylesheets(string body)


  body = Regex.Replace(body, @"[a-zA-Z]+#", "#");

  body = Regex.Replace(body, @"[\n\r]+\s*", string.Empty);

  body = Regex.Replace(body, @"\s+", " ");

  body = Regex.Replace(body, @"\s?([:,;{}])\s?", "$1");

  body = body.Replace(";}", "}");

  body = Regex.Replace(body, @"([\s:]0)(px|pt|%|em)", "$1");


  // Remove comments from CSS

  body = Regex.Replace(body, @"/\*[\d\D]*?\*/", string.Empty);


  return body;



The method takes a string of CSS and returns a minified version of it. The method have been modified for demo purposes, so you might want to optimize the code yourself.


I wanted to try something new this time, so I recorded my blog post as a screencast. Since I mostly write about code I thought it might be a good way to illustrate it in a video instead of in writing. It does add a new level of simplicity and understanding to the message. Please check it out and tell me if you like the video more than a regular blog post.


I hope the video illustrates just how easy it is to embed images in stylesheets and also how to use the online tool for image to base64 conversion.