I know this has been asked many many times. I have read most all posts on here and other sites like this one.
http://social.msdn.microsoft.com/Forums/en-US/ncl/thread/2931d21c-9ca8-4256-b213-915fad4c941b/
With no avail. Here's the environment
Windows Server 2008 R2 64bit
Visual Studio 2008
.Net Framework 3.5
Here is what I have tried
I had the proxy authenticating using code
WebRequest req = WebRequest.Create(requestUri + data);
req.Proxy = new System.Net.WebProxy(<ProxyURL>:<port>",true);
req.Proxy.Credentials = CredentialCache.DefaultCredentials;
WebResponse resp = req.GetResponse();
This worked, but seeing as it was slowing down the app I learned that I can edit the machine.config file which I did. It worked too!
<system.net>
<defaultProxy
useDefaultCredentials="true">
<proxy
proxyaddress="<proxyURL>:<port>"
bypassonlocal="True"/>
</defaultProxy>
</system.net>
At least for a day or 2. Then it began failing.
I then edited it to this
<system.net>
<defaultProxy
useDefaultCredentials="true">
<proxy usesystemdefault="True"/>
</defaultProxy>
</system.net>
From my understanding this will use IE settings to connect to proxy but still does not work. I also tried tihs code
WebProxy proxy = new WebProxy(<proxy>:<port>);
CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri(requestUri + data), "BASIC", new NetworkCredential(<username>,<password>));
proxy.Credentials = myCache;
request.Proxy = proxy;
request.Method = "GET";
And this did not work.
Note: I can copy the machine.config file to my computer(Win XP) and run the .exe(without the proxy code) from there and it works fine.
Is there something different I need to do with a 64 bit OS? Also I can open IE8 on the server and access the URI just fine. the goal is to preauthenticate the proxy without having to supply a username password in the code.