如何将System.Uri转换为字符串

时间:2014-03-28 06:58:20

标签: vb.net string uri httprequest

所以我想要实现的是让textbox1中有文本输入。然后当点击button1时,它将测试显示textbox1.text(www.google.com,www.youtube.com等)是否取决于textbox1.text,如果网站是否在线。

 Dim url As New System.Uri(TextBox1.Text) 'This is the line that I want to be textbox1.text instead of a url

    Dim req As System.Net.WebRequest

    req = System.Net.WebRequest.Create(url)

    Dim resp As System.Net.WebResponse

    ServerListBox1.Text = "Checking " + TextBox1.Text + "..."


    Try

        resp = req.GetResponse()

        resp.Close()

        req = Nothing

        ServerListBox1.Items.Add("[+] Server " + TextBox1.Text + " Is Online [+]")

    Catch ex As Exception

        req = Nothing

        Return

        ServerListBox1.Items.Add("[-] Server " + TextBox1.Text + " Is Offline [-]")

    End Try

0 个答案:

没有答案