views:

32

answers:

0

I am trying to get country location from the ip address which I am also looking up from actual url. However for certain urls I am getting the following error:

The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for

I wanted to use the following code to identify the proxy perhaps but since this is a regular console app I am not sure how to get around it. Here is my code;

For Each prod In querylist
    If myfetcher.getHtml(prod, userAgent, page) Then
      ' The lines below I use to find proxy ip
      ' but error name 'Request' not declared
        ' Dim nowip As String
        ' nowip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
        ' If nowip = "" Then
        'nowip = Request.ServerVariables("REMOTE_ADDR")
        'End If
        '

        If prod.Contains("http://") Then
            prod = Regex.Replace(prod, "http://", "")
        End If
        badHost = prod
        Dim ipEntry As IPHostEntry = Dns.GetHostByName(prod)
        Dim IPAdd As IPAddress() = ipEntry.AddressList
        Dim i As Integer = 0
        For i = 0 To IPAdd.GetUpperBound(0)
            number = number & "IP Address {0}:{1}" & IPAdd(i).ToString
        Next
        IPList.Add(prod & " " & number)
        number = ""
    Else
        badList.Add(prod)
        number = ""
    End If
    count = count + 1
Next