[英]C# System.NullReferenceException NSoup
似乎你不是唯一有問題的人 - https://nsoup.codeplex.com/workitem/8
似乎是圖書館本身的一個問題。
我使用WebClient
修復此問題以下載頁面。
using (WebClient wc = new WebClient())
{
wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows; Windows NT 5.1; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4");
string html = wc.DownloadString(url);
Document document = NSoupClient.Parse(html);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.