Check if remote file exists

boon

New member
Joined
Jun 7, 2007
Messages
2
Programming Experience
Beginner
Hi!
I would like to note that I'm kind of new to vb.net , so don't be too harsh on me ;) .

I have a text file(boon.somekindofhost.com/file.txt) on a http host , I need to check if it exists , if it doesn't then
execute myfunction() .
How could i do that?
The title was supposed to say "Check if remote file exists"
 
This seems to work:
VB.NET:
Function WebFileExists(ByVal url As String) As Boolean
    Try
        Dim web As New Net.WebClient
        Dim s As IO.Stream = web.OpenRead(url)
        s.Close()
        Return True
    Catch ex As Exception
    End Try
    Return False
End Function
 
Back
Top