Public Class MainClass
Public Shared Sub Main()
System.Console.WriteLine(IsConnectionAvailable())
End Sub
Public Shared Function IsConnectionAvailable() As Boolean
Dim objUrl As New System.Uri("http://www.yoursite.com/")
Dim objWebReq As System.Net.WebRequest
objWebReq = System.Net.WebRequest.Create(objUrl)
Dim objResp As System.Net.WebResponse
Try
objResp = objWebReq.GetResponse
objResp.Close()
objWebReq = Nothing
Return True
Catch ex As Exception
Return False
End Try
End Function
End Class