WebClient client = new WebClient()clientHeadersAdd(AcceptEncoding gzip deflate)string sUrl = byte[] byteArray = clientDownloadData(sUrl)
// 处理gzip string sContentEncoding = clientResponseHeaders[ContentEncoding]if (sContentEncoding == gzip)
{ ToolClassLogMessage(gzip ok page)MemoryStream ms = new MemoryStream(byteArray)MemoryStream msTemp = new MemoryStream()int count = GZipStream gzip = new GZipStream(ms CompressionModeDecompress)byte[] buf = new byte[]
while ((count = gzipRead(buf bufLength)) > )
{ msTempWrite(buf count)}
byteArray = msTempToArray()} // endgzip
string sHtml = EncodingGetEncoding()GetString(byteArray)