0

I share my domain link in social media network. i want to monitor the users clicks the link from which social, media, their ip address, their country. iam using the below code to get the info.

Dim url As String = "http://ipinfo.io"
Try
    Dim request As WebRequest = WebRequest.Create(url)
    Dim ws As WebResponse = request.GetResponse()

    Dim jsonString As String = String.Empty
    Using sreader As System.IO.StreamReader = New System.IO.StreamReader(ws.GetResponseStream())
        jsonString = sreader.ReadToEnd()
    End Using
    Dim jsSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer()
    Dim Information As ClientInfo = jsSerializer.Deserialize(Of ClientInfo)(jsonString)
    Catch ex As Exception
End Try

but it gives me the info of the hosting ip address, and country of my site.

Marco
  • 22,856
  • 9
  • 75
  • 124

1 Answers1

0

The service you are trying to connect to, ipinfo.io, is used to get your ip information. This is not useful when accessed server side. You will need to access this api on the client side and send this back to your server for logging.

An alternative can be found on this other answer How to get a user's client IP address in ASP.NET?

Community
  • 1
  • 1
Brian Gerhards
  • 839
  • 5
  • 12