views:

314

answers:

1

Dear experts,

I would like to use GZIP compression in classic ASP.I don't know the code for the same.Please help me what line of code should i put to use GZIP compression in classic ASP for my website.

I also want to compress CSS and javascript.Suggest howto do that.

Your help in this regard will be highly appreciated.

regards, sunny

+2  A: 

Are you talking about the data-stream you send back to the client? If so, this is normally the business of IIS and not something you'd control in ASP (and I don't think you have any control of it over ASP anyway). This can be done at the command line as:

cscript.exe adsutil.vbs set W3svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp"
cscript.exe adsutil.vbs set W3svc/Filters/Compression/GZIP/HcFileExtensions "css" "js" "html"

You may then need to restart IIS for the changes to take effect, so from command line:

iisreset

This MSDN article goes into all the details further.

If you're wanting to gzip and gunzip files that you subsequently work with in ASP, then you'll need an appropriate gzip library. There's a few articles out on t'interwebs for this suggesting libraries, techniques, etc.

Chris J
there are several sites hosted on the IIS ...i may want to do for one site..and can resetting IIS affect other sites ? what precautions should i take before doing this...
sunny
In IIS6, it's server-wide so all web-sites will be affected. In IIS7 it's per-web-site controllable: look at the IIS admin tool in Server 2008. For IIS7 you may need to install further modules (dynamic content compression isn't installed in IIS by default). You may not need to restart IIS, but if you do, that does mean you'll have some seconds of downtime whilst IIS restarts. The precautions you need to take depend purely on your local environment and will range from just doing it and hoping, letting folk know there's disruption, and having to schedule in downtime for some point in the future.
Chris J