Proxy settings for internet access

  • Thread starter Thread starter JezB
  • Start date Start date
J

JezB

I'm writing a windows forms application which accesses the internet at
various points in two different ways:
- calling a webservice (.wsdl),
- using the WebRequest & WebResponse methods.

I have a user that runs the software behind a firewall. He's getting proxy
errors thrown, quite understandably since I simply assume an internet
connection is available.

So, how can I :
(a) retrieve the proxy settings defined in the user's internet (IE) settings
?
(b) use these proxy settings in both the internet access methods mentioned
above ?

Any guidance greatly appreciated !
 
a) dont know
b) dont know but you can build and WebProxy and assing it to
wsProxy.Proxy for ws and to GlobalProxySelection.Select once for all
WebRequest

sample:

WebProxy proxyObject = new WebProxy(proxyURL,true);
proxyObject.Credentials = new System.Net.NetworkCredential(userName,
pwd); // be carful to specifie correclty domain account

wsProxy.Proxy = proxyObject; // for ws call
GlobalProxySelection.Select = proxyObject; //for WebRequest call
 
JezB said:
I'm writing a windows forms application which accesses the internet
at various points in two different ways: - calling a webservice
(.wsdl), - using the WebRequest & WebResponse methods.

I have a user that runs the software behind a firewall. He's getting
proxy errors thrown, quite understandably since I simply assume an
internet connection is available.

So, how can I :
(a) retrieve the proxy settings defined in the user's internet (IE)
settings ? (b) use these proxy settings in both the internet access
methods mentioned above ?

Any guidance greatly appreciated !

MSDN to the rescue ;-)

http://msdn.microsoft.com/msdnmag/issues/05/08/AutomaticProxyDetection/d
efault.aspx


Cheers,
 
Danny said:
.net2! :-(

I spent hours last week trying to debug a proxy issue - the proxy
required authentication (by a domain user), and the framework doesn't
pass this over, or provide a mean do it yourself. We had to set up a
new user on the clients domain, and hard-code its user/pass/domain in
our app :-(

Um... the article covers proxy detection in both .NET 1.1 and 2.0.
That's what the OP asked about. I don't see, how that relates to your
problem.

Cheers,
 
Back
Top