WebClient myWebClient = new WebClient(); // Download home page data. myWebClient.Headers["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"; myWebClient.Headers["Accept-Encoding"] = "gzip, deflate"; // Download the Web resource and save it into a data buffer. byte[] myDataBuffer = myWebClient.DownloadData("http://searchdns.netcraft.com/?restriction=site+ends+with&host=.sina.com.cn&lookup=wait..&position=limited"); // Display the downloaded data. string download = Encoding.ASCII.GetString(myDataBuffer);
// Download home page data.
myWebClient.Headers["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
myWebClient.Headers["Accept-Encoding"] = "gzip, deflate";
// Download the Web resource and save it into a data buffer.
byte[] myDataBuffer = myWebClient.DownloadData("http://searchdns.netcraft.com/?restriction=site+ends+with&host=.sina.com.cn&lookup=wait..&position=limited"); // Display the downloaded data.
string download = Encoding.ASCII.GetString(myDataBuffer);
然后你解析源文件就可以了