views:

162

answers:

2

I'm running the following code to check for updates in my software, and I wonder whether VB.Net will automatically user computer proxy settings:

Dim CurrentVersion As String = (New System.Net.WebClient).DownloadString("URL/version.txt")

If not, how can I adapt it to use proxy settings?

A: 

This can be done by adding the following settings to your application's app.config file:

<system.net>
    <defaultProxy useDefaultCredentials="true">
        <proxy usesystemdefault="True" />
    </defaultProxy>
</system.net>
Rowland Shaw
Is there a way to avoid using an app.config file?
CFP
yes, HttpWebRequest.Proxy, but may I ask what kind of proxy are you using? SOCKS proxies are not supported
Ion Todirel
Don't really know, I'm using my app without any proxy, but users asked me to add proxy support.
CFP
A: 

In fact, using

Dim UpdateClient As New System.Net.WebClient
UpdateClient.Proxy = System.Net.HttpWebRequest.DefaultWebProxy
Dim CurrentVersion As String = UpdateClient.DownloadString("URL/version.txt")

is perfectly functional.

CFP