网页抓取,asp.net C#源码
1 WebRequest request = WebRequest.Create("目标地址"); 2 WebResponse response = request.GetResponse(); 3 StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("gb2312")); 4 5 result = reader.ReadToEnd();//返回的html源码 6 7 reader.Close(); 8 reader.Dispose(); 9 response.Close();