I searched this question but didn't find anything that I was looking for, basically I want to use a proxy with htmlagilitypack, I had the code to do it before but lost it, here is the code I have so far, which is working. but I timed my self out on a program I was making and need to enable proxies.
private void button1_Click(object sender, EventArgs e)
{
StringBuilder output = new StringBuilder();
string raw = "http://www.google.com";
HtmlWeb webGet = new HtmlWeb();
webGet.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6";
var document = webGet.Load(raw);
}
Use an overload of HtmlWeb.Load()
that uses proxies. There are two overload signatures:
HtmlDocument Load(string url, string method, WebProxy proxy, NetworkCredential credentials);
HtmlDocument Load(string url, string proxyHost, int proxyPort, string userId, string password);
I don't have any first-hand experience using proxies in my code but I'd expect this to work.