16.7. Using Compression for Scripts
Modern browsers have the ability to decompress files, so you can reduce the time needed to download files to the browser by sending them in a compressed format. Text files compress very well. For example, the MicrosoftAjax.js file is more than 100K originally, but when compressed, it is reduced to about one third that size. It requires some extra CPU usage on the server to do the compression, but the compressed scripts can be cached on the server, so the processing overhead shouldn't matter much. The client will decompress the file once and then cache it as well, so the impact is minimal and the overall effect can be a benefit to the server and to the client.
16.7.1. Compression of Dynamic Scripts
The compression of dynamic scripts is controlled in the web.config file. The enableCompression and enableCaching attributes should be set to true:
system.web.extensions> <scripting> <scriptResourceHandler enableCompression="true" enableCaching="true" /> </scripting> </system.web.extensions>
Note that there are some tradeoffs in using compression and caching. Using compression without caching will make the server ...