Rick Strahl's Web Log

Wind, waves, code and everything in between...
ASP.NET • C# • HTML5 • JavaScript • AngularJs
Contact   •   Articles   •   Products   •   Support   •   Search
Ad-free experience sponsored by:
ASPOSE - the market leader of .NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more

IIS 6 Compression and App_Themes CSS


:P
On this page:

Hmmm. I finally got around to setting up static GZip compression on my server. I can't remember the reason why I didn't do this sooner, but today I was looking at some of my CSS files getting out of hand so I thought I better check into this again.

It's easy enough to do. MVP Omar Al Zabir has a nice post that summarizes how to set up IIS 6 for GZip compression which is quickly done by changing a few settings in Metabase.xml. IIS 6 basically writes out the content as compressed files to a sort of cache folder and then serves the compressed data directly from there (which incidentally might be a good approach for serving GZip content from ASP.NET more efficiently as well if you can cache the data).

Anyway it works without any fanfare, except it seems that none of the CSS content in any App_Themes folders are compression. Doing a quick search on App_Themes and IIS 6 compression turns up nothing.

On my site try the WebLog or the Web Store (checking with Fiddler or FireBug) both of which have App_Themes hosted CSS and both of which are not compressing. Yet on the home page the site style sheet (westwind.css) properly encodes.

It looks like there's something in the App_Themes folder foiling the compression (perhaps the long path name or the _). Here's what my compressed files folder looks like:

You can see all the files that have been compressed here. Notice there are NO App_Themes folder anywhere although there's about 10 ASP.NET apps running on my server.

Could anybody verify this behavior with their IIS 6 server by any chance?If you're running IIS 6 with static GZip compression can you check and see if App_Themes css files are getting compressed?

Posted in IIS  

The Voices of Reason


 

# DotNetSlackers: IIS 6 Compression and App_Themes CSS


Nicholas
June 05, 2007

# re: IIS 6 Compression and App_Themes CSS

Could the .NET engine be handling URLs with /app_themes/ in the path? This would probably only be true if you were mapping all requests through .NET. In that case, you'd need to turn on dynamic compression. Do you have that on?

Also, you might want to check out IISXpress, it's definitely helped me <a href="http://www.pdsys.org/blog/2007/05/16/HTTPCompressionJustDoIt.aspx">tame my HTTP compression woes</a>.

Nicholas
June 05, 2007

# re: IIS 6 Compression and App_Themes CSS

Also, have you tried using FileMon, etc. to trace what is happening on the filesystem during that time?

Rick Strahl
June 05, 2007

# re: IIS 6 Compression and App_Themes CSS

As far as I know ASP.NET is not serving .css related files or anything out of App_Themes. At least there's no script map for CSS, so unless it's some sort of filter, but I don't see why that would be since ASP.NET embeds the CSS paths into pages at compile time.

But something is definitely keeping App_Themes from compressing.

Rick Strahl
June 05, 2007

# re: IIS 6 Compression and App_Themes CSS

BTW, it looks like this is working properly in IIS 7. IIS 7 has static compression enabled by default so no settings are required. Dynamic compression can also be enabled quite easily.

Aki
January 28, 2008

# re: IIS 6 Compression and App_Themes CSS

Hi

I am working on themes in asp.net . I dont want to place my themes in the App_Themes folder instead I want my website to consume the themes from a diferent physical folder . Is that possible .

Warm Regards

Javier Perez
January 14, 2010

# re: IIS 6 Compression and App_Themes CSS

I actually run into the same problem with on a site it turn out that <compilation debug="true"> was the caused of this problem. In the web.config you need to set the <compilation debug="false"> so that the css files in App_Themes work with gzip.

Shash
April 28, 2010

# re: IIS 6 Compression and App_Themes CSS

I think IIS compresses the files individually and does not save the folder in the temp directory. I did run fiddler and I could see that the files are coming in as compressed. I'm going to turn it on on www.perfode.com and see what happens

Jeremy
May 11, 2010

# re: IIS 6 Compression and App_Themes CSS

Thanks to Javier... setting debug="false" solved my problem (and reminded me I forgot to change that last time)!
 

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2019