Maybe it works for other IIS versions as well, but I certainly was looking for a way of turning it on on our Windows 2000 development/test computer. So this is the long story:
HOW TO: Enable ASPX Compression in IIS

and this is the short one:
Step 1: backup your site metabase
Go to the Internet Information Services (IIS) tab and right click on it, go to All Tasks, choose Backup/Restore Configuration and save it.

Step 2: make the change to the metabase
Create a .bat file that has the following content:
net stop iisadmin
cd C:\InetPub\adminscripts
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
net start w3svc


Make sure to restart the SMTP service or any others that were stopped by the bat. I don't know how to start it from the command line and I pretty much don't care. The batch file will notify you of possible services it will shut down, but will restart in the end only the Web service.

The performance is immediately visible and it also works with Ajax.

Update:
This article was originally talking about Windows XP. Thanks to McHilarant (see comment below) I realized that, even if the changes in the metabase are possible on any IIS5 (Windows XP and Windows 2000), the actual compression will not be possible on XP. I remembered then that the actual modification that I did that time was not on my dev machine, but on our office server, therefore I updated the post accordingly.

Another Update:
Here is a link about a script to enable IIS 6 gzip compression: Script to Enable HTTP Compression (Gzip/Deflate) in IIS 6.

Comments

Siderite

<p>The post is about enabling it for dynamic files, like .aspx files and such. .htm is a static file and it can be compressed without too much complication.</p>

Siderite

Jason Fortuny

<p>Is there any reason you would NOT want to enable this for htm files?</p>

Jason Fortuny

Siderite

The post is about enabling it for dynamic files, like .aspx files and such. .htm is a static file and it can be compressed without too much complication.

Siderite

Jason Fortuny

Is there any reason you would NOT want to enable this for htm files?

Jason Fortuny

Siderite

<p>Very interesting article. Thanks. I think when I tested it it wa actually on an Win2000 machine. Now I feel stupid :)</p>

Siderite

McHilarant

<p>see this<br><a href="http://support.microsoft.com/kb/308168" rel="nofollow noopener" title="http://support.microsoft.com/kb/308168">http://support.microsoft.co...</a><br><br>no compression on xp possible.</p>

McHilarant

Siderite

Very interesting article. Thanks. I think when I tested it it wa actually on an Win2000 machine. Now I feel stupid :)

Siderite

McHilarant

see this<br>http://support.microsoft.com/kb/308168<br><br>no compression on xp possible.

McHilarant

Siderite

<p>I don't know then. If you find that the blog post is not complete/correct and you find out what was wrong, please let me know.</p>

Siderite

Sudev Gandhi

<p>Thanks for your prompt response.<br><br>Yes its XP Professional SP3 Machine.<br>Also response header says its <i>"Server: Microsoft-IIS/5.1"</i>.</p>

Sudev Gandhi

Siderite

<p>Are you sure you have IIS5 (XP) ? If it is a web server it is at least IIS6. There is another solution for different versions. My blog post covers the most difficult and obscure one, version 5.</p>

Siderite

Sudev Gandhi

<p>Well I also tried the above mentioned steps and configured IIS for compression.<br><br>But when I post back a page with AJAX Panel the response header says <br><b><br>HTTP/1.1 200 OK<br>Server: Microsoft-IIS/5.1<br>Date: Wed, 19 Aug 2009 12:39:27 GMT<br>X-Powered-By: ASP.NET<br>X-AspNet-Version: 2.0.50727<br>Pragma: no-cache<br>Transfer-Encoding: chunked<br>Cache-Control: no-cache, no-store<br>Pragma: no-cache<br>Expires: -1<br>Content-Type: text/plain; charset=utf-8<br></b><br><br>Thus I don't see<br>"Content-Encoding: deflate" or "Content-Encoding: gzip" in the response and it seems the response is not compressed.</p>

Sudev Gandhi

Siderite

I don&#39;t know then. If you find that the blog post is not complete/correct and you find out what was wrong, please let me know.

Siderite

Sudev Gandhi

Thanks for your prompt response.<br><br>Yes its XP Professional SP3 Machine.<br>Also response header says its <i>&quot;Server: Microsoft-IIS/5.1&quot;</i>.

Sudev Gandhi

Siderite

Are you sure you have IIS5 (XP) ? If it is a web server it is at least IIS6. There is another solution for different versions. My blog post covers the most difficult and obscure one, version 5.

Siderite

Sudev Gandhi

Well I also tried the above mentioned steps and configured IIS for compression.<br><br>But when I post back a page with AJAX Panel the response header says <br><b><br>HTTP/1.1 200 OK<br>Server: Microsoft-IIS/5.1<br>Date: Wed, 19 Aug 2009 12:39:27 GMT<br>X-Powered-By: ASP.NET<br>X-AspNet-Version: 2.0.50727<br>Pragma: no-cache<br>Transfer-Encoding: chunked<br>Cache-Control: no-cache, no-store<br>Pragma: no-cache<br>Expires: -1<br>Content-Type: text/plain; charset=utf-8<br></b><br><br>Thus I don&#39;t see<br>&quot;Content-Encoding: deflate&quot; or &quot;Content-Encoding: gzip&quot; in the response and it seems the response is not compressed.

Sudev Gandhi

Anonymous

<p>I tried this, batch file successful, but firebug still says gzip is not enabled. Did something change in XP SP3 possibly?</p>

Anonymous

Anonymous

I tried this, batch file successful, but firebug still says gzip is not enabled. Did something change in XP SP3 possibly?

Anonymous

Post a comment