Last post Aug 12, 2013 11:04 AM by Steven Cheng - MSFT
Aug 08, 2013 05:52 PM|bclayshannon|LINK
For asp.net sites/apps, is gzip compression something that must be enabled via a setting in web.config or something, or is it up to the host (assuming one uses a web hosting service) to "turn on" the gzipping? If so (web host does it), do they normally do
that as a matter of course or only when specifically requested?
Aug 09, 2013 02:07 AM|ramu.net|LINK
No, They don't do by default. We need to specify "gzipping" compression via setting in web.config file.
Aug 09, 2013 09:42 AM|bclayshannon|LINK
Okay, then, what is the "syntax" for that (what is the exact entry required)?
Aug 12, 2013 11:04 AM|Steven Cheng - MSFT|LINK
The gzip compression you mentioned is just a particular case of the compression supported by HTTP protocol. And normally, such compression is supported and performed at webserver layer.
For ASP.NET web application, the HTTP compression is relying on the compression support in IIS web server. And IIS web server supports compression for both static contents (like htm, js, css files...) and dynamic contents (like .asp, .aspx, .ashx....). And
compression is configured based on content-type (so that responses of specific content-types will be compressed). Here are references about configuring HTTP compression in IIS 7.
#Configuring HTTP Compression in IIS 7
#Making the most out of IIS compression - Part 1: Configuring IIS 7 compression
#How to add content types for HTTP compression in IIS 7.0
When webserver accept HTTP requests from client, it will inspect the HTTP header (for compression support) to see if client agent (webbrowsers) support certain compression types (gzip, deflate, etc...). If client supports, it will send response in compressed
format which can significantly reduce network payload size. For dynamic compression, it can help compress response content of dynamic service extensions like webservice, WCF, httphandler, etc... But dynamic compression will also spend significant server CPU
#Dynamic Compression in IIS 7