日期:2014-05-17 浏览次数:20661 次
WebClient client = new WebClient();
client.Encoding = Encoding.GetEncoding("utf-8");
string htmlStr = client.DownloadString(url);
WebRequest request = HttpWebRequest.Create("http://www.bengou.com/all/index.html?contentfolder=&areafolder=&letterfolder=&state=2&order=update&p=2");
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
Console.WriteLine(response.ContentEncoding);
using (GZipStream zipStream = new GZipStream(response.GetResponseStream(), CompressionMode.Decompress, false))
{
using (StreamReader reader = new StreamReader(zipStream))
{
Console.WriteLine(reader.ReadToEnd());
}
}