views:

527

answers:

2
+1  A: 

In .NET 1.0, you could use:

WebRequest.DefaultWebProxy = WebProxy.GetDefaultProxy();

In 2.0, DefaultWebProxy is supposed to contain the IE proxy settings by default, so this method is obsolete.

http://www.west-wind.com/WebLog/posts/2542.aspx has more information.

UPDATE: Apperently the .NET 2.0 method is now;

WebRequest.DefaultProxy = WebRequest.GetSystemWebProxy();

http://msdn.microsoft.com/en-us/library/system.net.webrequest.getsystemwebproxy.aspx

MiffTheFox
I was about to reply the same thing. This obsolete method does not work in my circumstances. I am starting to think that the .GetSystemWebProxy() just does the same thing as this call.
Tim Jarvis
But then what kind of exception does it throw? And GetSystemWebProxy is the new one, so I think there must have been some kind of change.
MiffTheFox
The error is in the question above "Unable to connect to remote server"
Tim Jarvis
@Tim J - That sounds like an error with the proxy itself...
MiffTheFox
+1  A: 

sigh, well after more investigation I fixed this problem just to get a different one....

The fix is to create the WebProxy with the .pac Uri

WebProxy proxy = new WebProxy(@"http://blahblah/proxy.pac);

Easy peasy...

So now I am getting through the proxy, but the Proxy server is messing with my request and the web service is barffing. (Note it doesn't do it if I am specific about the proxy address....sigh)

Tim Jarvis