Hi, I've tried to get the geolocation of the clients IP, with this code:
Dim rssReq As System.Net.WebRequest = _
System.Net.WebRequest.Create("http://freegeoip.appspot.com/xml/" _
& vl_bContadorVisitasBE.vcConVisIP)
'Crear el Proxy
Dim px As New System.Net.WebProxy("http://freegeoip.appspot.com/xml/" _
& vl_bContadorVisitasBE.vcConVisIP, True)
'Asignar el Proxy al objeto WebRequest
rssReq.Proxy = px
'Establecer el tiempo de vida al objeto WebRequest
rssReq.Timeout = 2000
Try
'Obtener el objeto WebResponse
Dim rep As System.Net.WebResponse = rssReq.GetResponse() <-- ERROR
'Insertar el objeto Response en el objeto XMLTextReader
Dim xtr As New System.Xml.XmlTextReader(rep.GetResponseStream())
'Insertar el objeto Response en el objeto DataSet
ds.ReadXml(xtr)
Catch ex As Exception
End Try
But I keep getting the error "The underlying connection was closed: An unexpected error occurred on a receive." when executes the GetResponse line.
I tried to get better methods to do the same, but no luck.
The XML returned by the WS (http://freegeoip.appspot.com/xml/200.62.145.200) is something like this:
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<Status>true</Status>
<Ip>200.62.145.200</Ip>
<CountryCode>PE</CountryCode>
<CountryName>Peru</CountryName>
<RegionCode>15</RegionCode>
<RegionName>Lima</RegionName>
<City>Lima</City>
<ZipCode />
<Latitude>-12.05</Latitude>
<Longitude>-77.05</Longitude>
</Response>
So I need to parse into a ds or a dt, or something that I could read.
Thanks in advance.
Omar