Proxy settings

Topics: Developer Forum, User Forum
Jun 17, 2008 at 6:45 AM
How can I specify proxy settings for HtmlWeb or does it use the same default IE proxy settings?
Jul 17, 2008 at 12:40 PM

Hello,

try the sampleproject "googler" and look into googler.cs

// We use a Webclient to query and impose as "Internet Explorer 7"

 

WebClient client = new WebClient();

 

 

// ADD the following lines and you will have a proxy with authentification
NetworkCredential
nc = new NetworkCredential("yourname", "yourpw");

 

 

WebProxy wp = new WebProxy("yourproxyIPorHostname:8080", true, null, nc);

 

client.Proxy = wp;

client.Headers.Add(

"User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)");

with best regards

marco