【发布时间】:2014-06-20 10:52:55
【问题描述】:
我最近一直在使用 C# 中的WebClient 下载网页内容。 WebClient 的DownloadString 方法无法从iframe 下载内容。
下载内容的短代码已用作:
using (var client = new WebClient())
{
string html = client.DownloadString("url");
}
在 C# 中读取 iframe 内容需要什么?
对于测试,我使用的是 http://multiprofits.co.uk/oddsmatcher.html 网站,其中包含 iframe。
【问题讨论】:
-
要么使用
HtmlAgilityPack手动解析内容,然后用另一个DownloadString请求加载iframe,要么使用WebBrowser(支持much more complex web scrapping scenarios)。 -
这里的问题是从另一个DownloadString获取的iframe内容在原始网页中显示不正确。
-
@akash88 与stackoverflow.com/questions/14429023/… 重复?
-
@akash88,然后使用
WebBrowser,点击我发布的链接。 -
@PaulZahra :问题与该解决方案相同。
标签: c# html iframe web-scraping webclient