The best way that i come up with and that actually found it working as wanted, because all the methods out there is just to check if the domain is found, so if the domain is found and the file is not, it will still tell you that the file is found, and my method is to try and download that file using DownloadFileAsync
and run a timer for 3 second and after 3 second you check if any bytes were download from that file, if so, then this file is surly found through that link, if not, then it's not found, and then you can cancel the download and delete that file that has been created on you PC.
Here is a my code for that :
Imports System.IO
Imports System.Net
Public Class Form1
Dim BytesReceived As Integer
Public WithEvents Download As WebClient
Private Sub DownloadBUT_Click(sender As Object, e As EventArgs) Handles Button1.Click
Download = New WebClient
Download.DownloadFileAsync(New Uri("http://example.com/FileName.exe"), My.Computer.FileSystem.SpecialDirectories.Desktop & "FileName.exe")
CheckFileTimer.Start()
DownloadBUT.Enabled = False
End Sub
Private Sub Download_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles Download.DownloadProgressChanged
BytesReceived = e.BytesReceived
End Sub
Private Sub CheckFileTimer_Tick(sender As Object, e As EventArgs) Handles CheckFileTimer.Tick
CheckFileTimer.Stop()
If BytesReceived = 0 Then
MsgBox("File not found!")
Else
MsgBox("File found!")
End If
DownloadBUT.Enabled = True
Download.CancelAsync()
Try
File.Delete(My.Computer.FileSystem.SpecialDirectories.Desktop & "FileName.exe")
Catch ex As Exception : End Try
End Sub
End Class
Hope this was useful to you :)