检查IP和URL表单列表是否存在

时间:2014-10-23 13:08:38

标签: vb.net

现在我有:

Dim i As Integer  
  Dim web As New WebClient With {.Proxy = Nothing}
  'http://1.2.3.4/sql.db
   Dim attkstring As String = "/sql.db"
   i = 0
   Dim shellx As Integer = 0
   Dim sUrl As String = shells.Items(shellx) & attkstring
  For Each item In shells.Items
Try
    If web.OpenRead(sUrl) = True Then

    End If

Catch ex As Exception
End Try
  shellsloadedtext.Items.Add(sUrl)
  shellx += 1
Next

但是在我的ListBox中写了所有(ip + url),我需要写一个IP + URL以防万一工作,现在写它们即使没有

Ex:real ip:7.7.7.7 false ip:1.1.1.1

我写在ip列表7.7.7.7 1.1.1.1

我的ListBox shellsloadedtext wirte 7.7.7.7/sql.db和1.1.1.1/sql.db

帮帮我

1 个答案:

答案 0 :(得分:0)

试试这个:

Imports System.Net

Function UrlExists(destination As String) As Boolean

    Dim url As New Uri(destination)
    Dim request As WebRequest = WebRequest.Create(url)

    Try
        Using response As WebResponse = request.GetResponse
            Return True
        End Using
    Catch ex As Exception
        Return False
    End Try

End Function