|
-
Jun 19th, 2008, 06:02 AM
#1
Thread Starter
Frenzied Member
[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.
-
Jun 19th, 2008, 12:07 PM
#2
Re: [1.0/1.1] Connect WebClient through Proxy server
-
Jun 20th, 2008, 03:42 AM
#3
Thread Starter
Frenzied Member
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...
-
Jun 22nd, 2008, 01:49 PM
#4
Re: [1.0/1.1] Connect WebClient through Proxy server
Identity Impersonate set to true, with Windows Auth?
-
Jun 25th, 2008, 07:46 AM
#5
Thread Starter
Frenzied Member
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.
-
Jun 25th, 2008, 10:08 AM
#6
Thread Starter
Frenzied Member
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);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|