I’m trying to download web page:
string remoteUri = "http://whois.domaintools.com/94.100.179.159";
WebClient myWebClient = new WebClient();
byte[] myDataBuffer = myWebClient.DownloadData(remoteUri);
string download = Encoding.ASCII.GetString(myDataBuffer);
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(download);
doc.Save("file1.htm");
Having an error
webexception was unhandled: (403) Forbidden.
Are there any other ways to download the page?
I’ve tried HtmlDocument class, but as i can see it needs loaded web page in the browser.
HtmlWeb hwObject = new HtmlWeb();
string ip = "http://whois.domaintools.com/";
HtmlAgilityPack.HtmlDocument htmldocObject = hwObject.Load(ip);
foreach (HtmlNode link in htmldocObject.DocumentNode.SelectNodes("//meta[@name = 'description']"))
{
...
}
1 Answer