2013-03-19 82 views
0

與HTML敏捷包錯誤,當我調試代碼,並得到:其中htmldoc =新的HTML文檔(); 所以它會找到一個文件HtmlDocument.cs 這是一個錯誤,我該如何解決它?htmlagilitypack錯誤當我來到htmldocument

string Url = "http://www.mittanbud.no/bedriftsok/?q=Baderom"; 

     var htmlDoc = new HtmlDocument(); 
     htmlDoc.OptionReadEncoding = false; 
     var request = (HttpWebRequest)WebRequest.Create(Url); 
     request.Method = "GET"; 
     using (var response = (HttpWebResponse)request.GetResponse()) 
     { 
      using (var stream = response.GetResponseStream()) 
      { 
       htmlDoc.Load(stream, Encoding.UTF8); 
      } 
     } 
+0

你得到的錯誤是什麼? – jordanhill123 2013-03-19 08:03:25

+0

這個,我弄錯了:http://postimage.org/image/62rw2m8g1/ – Max 2013-03-19 08:09:57

+0

你發佈的圖片是沒用的。請發佈完整的異常堆棧。我個人對你發佈的代碼沒有錯誤,它工作正常。 – 2013-03-19 11:17:57

回答

0

試試這個代碼:

HtmlWeb web = new HtmlWeb(); 
HtmlAgilityPack.HtmlDocument doc = web.Load(Url); 
+0

現在我得到相同的錯誤,但與htmlweb.cs相反,因爲它尋找 – Max 2013-03-19 08:08:34

+0

添加錯誤說明的問題請 – 2013-03-19 08:10:03

+0

http://postimage.org/image/62rw2m8g1/ – Max 2013-03-19 08:13:13

0

也許二進制文件,鏈接到你的項目,都建有來源的另一個版本。嘗試重建htmlagilitypack。