VB - Check URL for availability

By , 4/28/2008
(1 ratings)
This function checks if a given internet address is available.
Translate to C#
Public Function CheckURL(ByVal URL As String) As Boolean
    Try
        Dim Response As Net.WebResponse = Nothing
        Dim WebReq As Net.HttpWebRequest = Net.HttpWebRequest.Create(URL)
        Response = WebReq.GetResponse
        Response.Close()
        Return True
    Catch ex As Exception
    End Try
End Function
Tagged with url, uri, http.

Comments

 

Log in, to comment!