How do I get WebProxy to work in HttpWebRequest?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I found an example online and when I tried repeating it with the proxy I
normally use for my browser, I get errors.

What I do is this:

WebProxy proxy = new WebProxy("http://www.autoconfig/pac", true);

That url is exactly what I enter into Firefox advanced settings to get
beyond the office firewall here, but C# does not like it.

any idea?

the proxy is free, no login credentials required so I did not set that
object in code. You can try it yourself now, the proxy wont interfere with
the fact you are not behind a firewall.
 
MrNobody,

Are you actually setting the Proxy property of the HttpWebRequest to
that instance of the WebProxy?
 
Yes indeed,

req.Proxy = proxy;



Nicholas Paldino said:
MrNobody,

Are you actually setting the Proxy property of the HttpWebRequest to
that instance of the WebProxy?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

MrNobody said:
I found an example online and when I tried repeating it with the proxy I
normally use for my browser, I get errors.

What I do is this:

WebProxy proxy = new WebProxy("http://www.autoconfig/pac", true);

That url is exactly what I enter into Firefox advanced settings to get
beyond the office firewall here, but C# does not like it.

any idea?

the proxy is free, no login credentials required so I did not set that
object in code. You can try it yourself now, the proxy wont interfere with
the fact you are not behind a firewall.
 
And what kind of errors are you getting? Can you create a complete
example program?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

MrNobody said:
Yes indeed,

req.Proxy = proxy;



Nicholas Paldino said:
MrNobody,

Are you actually setting the Proxy property of the HttpWebRequest to
that instance of the WebProxy?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

MrNobody said:
I found an example online and when I tried repeating it with the proxy I
normally use for my browser, I get errors.

What I do is this:

WebProxy proxy = new WebProxy("http://www.autoconfig/pac", true);

That url is exactly what I enter into Firefox advanced settings to get
beyond the office firewall here, but C# does not like it.

any idea?

the proxy is free, no login credentials required so I did not set that
object in code. You can try it yourself now, the proxy wont interfere
with
the fact you are not behind a firewall.
 
Back
Top