1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Public Function IsConnectionAvailable() As SortedList(Of String, Boolean)
Dim sites As String() = New String() {"http://www.imabox.fr", "http://www.google.fr"}
Dim b As New SortedList(Of String, Boolean)
For Each Sit In sites
Dim objUrl As New System.Uri(Sit) ' Je ne vois pas quoi mettre
Dim objWebReq As System.Net.WebRequest
objWebReq = System.Net.WebRequest.Create(objUrl)
Dim objresp As System.Net.WebResponse
Try
objresp = objWebReq.GetResponse
objresp.Close()
objresp = Nothing
b.Add(Sit, True)
Catch ex As Exception
objresp = Nothing
objWebReq = Nothing
b.Add(Sit, False)
End Try
Next
Return b
End Function |
Partager