Click here to Skip to main content
Click here to Skip to main content

Enable Gzip compression in IIS 6.0 for ASP.NET 2.0 websites

By , 19 Nov 2008
 

Introduction

This step by step guide will show you how to enable Gzip compression to work with ASP.NET 2.0. Compressing the output should make your websites faster, especially when being viewed via a slow connection.

Step 1: Enable Compression Using the IIS Manager

Expand IIS Manager. Right click on Websites. Click Properties. Click the Service tab. Check the boxes to enable compression.

Step 2: Install IIS 6.0 Resource Kit Tools

You can download the free tool from Microsoft here.

Step 3: Edit IIS Meta Database

Open the IIS Metabase Explorer. It is part of the resource kit you just installed. Expand LM>W3SVC>Filters>Compression. You will need to edit both gzip and deflate. Find the item with the name HcScriptFileExtensions. Add the values aspx, axd, asmx, and css. Repeat process for gzip and deflate. Find HcDynamicCompressionLevel and set it to something higher than 0.

Step 3: Do IISReset

That's it. To verify that you have everything working correctly, you can use the free tool YSlow for Fire Bug.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

ToddHileHoffer
Web Developer
United States United States
Member
Life.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralIIS is Gzipping all files including GIFmemberJRev9 Jan '09 - 4:01 
Hi there,
 
Thank you for your article, I applied this 2 development servers. On one everything is working fine, but on the other, when I look in YSlow gifs are being gzipped and the login page is not displaying correctly. I am also getting the following error -
 
Error: The stylesheet http://ukromwsapp008/JapanB2B/Security/Login.aspx?ReturnUrl=%2fJapanB2B%2fApp_Themes%2fJapanB2B%2fcss%2fJapanStyleSheet.css was not loaded because its MIME type, "text/html", is not "text/css".
Source File: http://ukromwsapp008/JapanB2B/Security/Login.aspx?ReturnUrl=%2fJapanB2B%2fDefault.aspx
Line: 0
 
My MIME type are all set up correctly, any ideas as to why this might be happening?
 
Many Thanks,
Julie
GeneralRe: IIS is Gzipping all files including GIFmemberClaus Conrad30 Jan '09 - 10:11 
Have you made sure that the *.css file is not protected by FormsAuthentication, i. e. by making a location exception in your Web.config ?
GeneralRe: IIS is Gzipping all files including GIFmemberJRev3 Feb '09 - 7:42 
Hi Claus, Thank you for responding, the cause of this problem was short URLs, they were set up on one server but not the other. I have removed the short URLs and all is working perfectly again.
Regards,
Julie

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 19 Nov 2008
Article Copyright 2008 by ToddHileHoffer
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid