问题描述
我正在编写一个Web抓取工具,但是我无法让代码在家中工作,因为它没有获得所请求的URL,而是获得了宽带路由器主页html。 Firefox和Internet Explorer可以正常打开页面。但是在C#中,我不知道我需要做些什么来模仿浏览器为通过路由器所做的一切。我认为这是webClient上的某个设置,但是呢?
private void cmdstart_Click(object sender,EventArgs e)
{
WebClient webClient1 = new WebClient();
downloadURL = txtURL.Text;
domain = GetDomain(downloadURL);
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
ProcessSource(webClient1.DownloadString(downloadURL));
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)