我正在尝试从网站检索一些信息,解析出特定项目,然后继续我的生活。
我注意到,当我在网站上检查“查看源代码”时,结果与我使用 WebClient 类的 DownloadFile 方法时看到的结果相匹配。另一方面,当我使用 DownloadString 方法时,该字符串的内容与视图源和 DownloadFile 都不同。
我需要 DownloadString 返回类似的内容以查看源和 DownloadFile。有什么建议么?我的相关代码如下:
string criticalPathUrl = "http://blahblahblah&sessionId=" + sessionId;
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
//this is different
string urlContentsString = wc.DownloadString(criticalPathUrl);
//than this
wc.DownloadFile(criticalPathUrl, "rawDlTxt2.txt");
编辑:请忽略这个问题,因为我只是没有向上滚动。啊。那些日子中的一天。