Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27472

VS 2013 Downloading an http file with no caching

$
0
0
I am downloading an http file from an ftp server of mine. This file holds the version number for my application, and as such is updated when a new version of my application is released to the public.

Currently, the file being downloaded is not the latest file on the webserver, and is an old file. I am guessing that this is because an old version of the file exists as a cached file.

Can someone have a quick look at my code to see why I am not getting the latest version.

Here is my code:

Code:

    Public Function GetWebFile(WebAddress As String) As String
        Try
            Dim WebClientForApplicationVersion As New System.Net.WebClient
            WebClientForApplicationVersion.CachePolicy = New System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore)
            Dim ApplicationVersionInformation As String = WebClientForApplicationVersion.DownloadString(WebAddress)
            Return ApplicationVersionInformation
        Catch ex As Exception
            Return "Error"
        End Try
    End Function


Viewing all articles
Browse latest Browse all 27472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>