' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.IO
Imports System.Net

Class MainClass
    Public Shared Sub Main(ByVal args As String())
        Console.WriteLine(UrlTester.Test("http://www.eksperten.dk/"))
        Console.WriteLine(UrlTester.Test("http://www.eksperten.dk/notexist.html"))
    End Sub
End Class 

Public Class UrlTester
    Public Shared Function Test(ByVal url As String) As Boolean
        Dim req As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
        req.Method = "HEAD"
        Try
            Dim resp As HttpWebResponse = CType(req.GetResponse, HttpWebResponse)
            resp.Close
            Return True
        Catch 
            Return False
        End Try
    End Function
End Class
