我正在尝试使用 WebClient.DownloadString 检索站点的源,但是当我调试字符串时,我正在将源写入它似乎切断了 html 源的一部分。
代码:
public string GetWebpageSource()
{
using (WebClient client = new WebClient())
{
client.Headers[HttpRequestHeader.UserAgent] = "Mozilla / 5.0(Windows NT 10.0; Win64; x64; rv: 44.0) Gecko / 20100101 Firefox / 44.0";
client.Encoding = Encoding.UTF8;
string htmlcode = client.DownloadString("http://2007.runescape.wikia.com/wiki/Bandos%20page%201");
return htmlcode;
}
}
所以我想知道为什么会这样?如果需要其他信息,我会发布。谢谢阅读!