Private Sub ipcheckBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ipcheckBTN.Click If pubipRTF.Text = "" Then MsgBox("Please enter an IP-Adress...") Else Try Dim httpRequest As HttpWebRequest = HttpWebRequest.Create("http://whatismyipaddress.com/ip/" & pubipRTF.Text) Dim httpResponse As HttpWebResponse = httpRequest.GetResponse() Dim reader As StreamReader = New StreamReader(httpResponse.GetResponseStream) Dim httpContent As String = reader.ReadToEnd ipcheckBTN.Text = "..." Dim re1 As String = ".*?" 'Non-greedy match on filler Dim re2 As String = "(http:\/\/whatismyipaddress\.com\/images\/flags\/(?:[a-z][a-z0-9_]*)\.png)" 'flag Dim re3 As String = "(</th><td>(?<country>([\sa-zA-Z0-9.:-_/]+)) <img )" 'country Dim r1 As Regex = New Regex(re1 + re2, RegexOptions.IgnoreCase Or RegexOptions.Singleline) Dim m1 As Match = r1.Match(httpContent) If (m1.Success) Then Dim httpurl1 = m1.Groups(1) flagPICT.ImageLocation = httpurl1.ToString flagurlRTF.Text = httpurl1.ToString End If For Each m As Match In Regex.Matches(httpContent, re3, RegexOptions.Singleline Or RegexOptions.IgnoreCase) locationRTF.Text = m.Groups("country").ToString Next ipcheckBTN.Text = "Check" Catch ex As Exception MsgBox(ex.Message) End Try End If End Sub
Dim httpRequest As HttpWebRequest = HttpWebRequest.Create("http://whatismyipaddress.com/ip/" & pubipRTF.Text)causes this error.Do you have any tips that can lead to the possible fix?