How do I get WebProxy to work in HttpWebRequest?

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.
 
N

Nicholas Paldino [.NET/C# MVP]

MrNobody,

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

Guest

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.
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top