[RESOLVED] [1.0/1.1] Connect WebClient through Proxy server
I've written a simple automatic updater for some old software of ours however it doesn't work through my clients proxy server as it requires authentication.
I don't want to have to prompt the user to enter their username/password again when they are already logged so is there a way I can grab their credentials?
Cheers.
Re: [1.0/1.1] Connect WebClient through Proxy server
Re: [1.0/1.1] Connect WebClient through Proxy server
I have tried using this with the webclient without success. I'll play a bit more...
Re: [1.0/1.1] Connect WebClient through Proxy server
Identity Impersonate set to true, with Windows Auth?
Re: [1.0/1.1] Connect WebClient through Proxy server
At the moment I have:
Code:
WebClient myWebClient = new WebClient();
myWebClient.Credentials = CredentialCache.DefaultCredentials;
Byte[] myDataBuffer = myWebClient.DownloadData(remoteUri + UpdateFileName);
But this is unable to authenticate with the proxy server. This needs to work without the user having to supply a username and password.
I can browse directly to the file (remoteUri + UpdateFileName) using a browser on the users machine.
Re: [RESOLVED] [1.0/1.1] Connect WebClient through Proxy server
Got it working then had a problem if the there wasn't a proxy in place and then the text file that was being retrieved was being cached. Solution in case it helps anyone else out or in case (more likely) someone shows me a better way to do it:
Code:
WebProxy proxy = new WebProxy();
proxy = WebProxy.GetDefaultProxy();
proxy.Credentials = CredentialCache.DefaultCredentials;
GlobalProxySelection.Select = proxy;
WebClient myWebClient = new WebClient();
Byte[] myDataBuffer = myWebClient.DownloadData(remoteUri + UpdateFileName + "?rnd=" + DateTime.Now.Millisecond);