Proxy support in VB.Net

I am running the following code to check for updates in my software and I am wondering if VB.Net will automatically set user proxy settings:

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

      

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

+2


a source to share


2 answers


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")

      



perfectly functional.

+1


a source


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



<system.net>
    <defaultProxy useDefaultCredentials="true">
        <proxy usesystemdefault="True" />
    </defaultProxy>
</system.net>

      

0


a source







All Articles