1.添加引用.net 引用Microsoft.mshtml
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string str = wc.DownloadString(@"http://www.jb51.net/web/73969.html");
HTMLDocumentClass doc = new HTMLDocumentClass();//獲取html對象
doc.designMode = "on"; //不讓解析引擎去嘗試運行javascript
doc.IHTMLDocument2_write(str);把html 文檔寫入html對象中
doc.close();關閉寫流
Console.WriteLine(doc.title);輸出標題
Console.WriteLine(doc.body.innerText); 輸出body
Console.ReadKey();