0

I followed the sample from here to compress my page:

http://www.codeproject.com/KB/aspnet/Aspx_Compression.aspx

But the result I get is a page full of odd characters:

���I�%&/m�{J�J��t��$ؐ@�������iG#)�*��eVe]f@�흼��{����{����;�N'

Not sure what's wrong with that code?

I tried the code both in Page_Load and Page_Render events.

Any idea?

Thanks,

Update: just an update; my code was wrong! debugged it with FireBug/Net tab and it was revealed that a wrong Header was added.

The Light
  • 26,341
  • 62
  • 176
  • 258
  • Any reason not to use dynamic compression of dynamic content in IIS? http://technet.microsoft.com/en-us/library/cc753681%28WS.10%29.aspx – Icarus Sep 26 '11 at 13:08
  • See the SO question http://stackoverflow.com/questions/552317/how-to-implement-gzip-compression-in-asp-net – Prasanth Sep 26 '11 at 13:16
  • I don't have access to IIS settings on the production server so if it can be done in the code, that's preferable. – The Light Sep 26 '11 at 13:24
  • @William Do you wish to compress the CSS and javascript also? – Prasanth Sep 26 '11 at 13:28
  • @Prasanth; I'm using JSBuilder to compress some custom js files. but yes how would you recommend compressing all css and js files? – The Light Sep 26 '11 at 13:42

1 Answers1

1

Use SquishIt to compress the CSS and JavaScript. It is a very good tool

See a good article on SquishIt

You can dowload the SquishIt from GitHub

Itay A
  • 120
  • 1
  • 5
Prasanth
  • 3,029
  • 31
  • 44