The Net.WebClient class doesn't support HTTP compression, eg, when you add the Accept-Encoding: gzip,deflate header to your request:
This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2004/08/netwebclient-and-gzip.html
Of course in the REAL world, before un-gzipping, you’d actually check to make sure the response header contained the
header indicating the byte array you got was actually compressed… right? right?
How about web services? Could they also be encoded with gzip?
BEWARE! The SharpLipZip does not seem to properly support “deflate” type compression. At least I can’t find any references in Google to anyone who actually GOT it to work… fortunately this type of compression is rare. But still, I’d modify…
to be just
and prevent any future problems.
For webservices, assuming compression is enabled on the server side, all you have to do is set the EnableDecompression property to true on your proxy class generated with the wsdl tool.
In fact the .NET 2.0 docs clearly states EnableDecompression is set to true by default so all you need is to make the server send it gzip compressed.
Look it up in the docs or google on “EnableDecompression”.
We are using ICSharpCode in Sitemap Writer Pro for compression of big sitemap files.