http gzip 解压缩


          var sContentEncoding = httpRespone.Headers["Content-Encoding"];
                
                if(sContentEncoding == "gzip")
                {
		    
                    MemoryStream msTemp = new MemoryStream();

                    int count = 0;
                    GZipStream gzip = new GZipStream(httpRespone.GetResponseStream(), CompressionMode.Decompress);
                    byte[] buf = new byte[1000];
                    byte[] byteArray = null;

                    while((count = gzip.Read(buf,0,buf.Length)) > 0)
                  {     
                           msTemp.Write(buf,0,count);
                    }
                    byteArray = msTemp.ToArray();
		    
                    string sHtml = Encoding.UTF8.GetString(byteArray);

                }

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM