views:

36

answers:

2

hi, i know we can compress response by declaring Response.Filter as GZip or Delfalte streams, but how i can perform both compression and minification together? declaring new class that inherits Stream, then first performing minify on content, then compress that by GZip or Deflate depending on User-Agent supported each?

A: 

hm... 2 days and nothing. check out Mads Kristensen approach http://madskristensen.net/post/A-whitespace-removal-HTTP-module-for-ASPNET-20.aspx. however this isn't exactly that i want but is better than nothing ;)

Sadegh
+1  A: 

For javascript & css files, you can minify them using Microsoft Ajax Minifier 4.0.
You can also use Microsoft Ajax Minifier as a Build Task.

For response compression, you are on the right way, you can use Response.Filter and use either GZip or Delfalte streams.
For a sample code for using Response.Filter, refer to the following article Combining, Compressing, Minifying ASP.NET ScriptResource and HTML Markups.

Also, you can use IIS to compress content.

Ahmed