我试图用httpwebrequest打开adfoc.us/504....9链接。 但它没有给我HTML代码。无法获取HTML
try
{
req = WebRequest.Create(txtLink.Text);
WebProxy wp = new WebProxy(proxies[0]);
//req.Proxy = wp;
WebResponse wr = req.GetResponse();
StreamReader sr = new StreamReader(wr.GetResponseStream());
string content = sr.ReadToEnd();
MessageBox.Show(content);
sr.Close();
}
catch (UriFormatException)
{
MessageBox.Show("URL should be in this format:\nhttp://www.google.com");
return;
}
如果我使用网站像[google.com] [1] - 我得到谷歌html源码的mbox。 如果我使用adfoc.us/50....
链接,我会得到一个空字符串。
问题出在哪里? 谢谢。
编辑:我通过安装GeckoFx组件解决了这个问题。
因为此链接不包含任何内容 – akhil 2012-07-09 09:47:15
当我如何在浏览器中打开它?我检查了篡改数据,我认为有一些重定向。 – 2012-07-09 09:48:36
我没有收到任何重定向。 – ZippyV 2012-07-09 09:49:57