Stream responseStream;
try
{
WebResponse wr = httpRequest.GetResponse();
responseStream = wr.GetResponseStream();
if (wr.Headers["Content-Encoding"] == "gzip")//gzip解压处理
{
MemoryStream msTemp = new MemoryStream();
GZipStream gzs = new GZipStream(responseStream, CompressionMode.Decompress);
byte[] buf=new byte[1024];
int len;
while ((len = gzs.Read(buf, 0, buf.Length)) > 0)
{
msTemp.Write(buf, 0, len);
}
msTemp.Position = 0;
responseStream = msTemp;
}
}
catch
{
return "";
}