0

I want to see the ip of a client connected to my web site. I'm developing in asp.net + vb.net.

I've added this to my code:

Dim clientIp As String = Request.UserHostAddress

or

Dim clientIp As String = Request.ServerVariables("REMOTE_ADDR")

And when i'm on the localhost i get the right '::1' string.

But when i deploy the webapp and i connecting from another pc i get the ip of the server in "clientIp"

So, how i can get the client ip??

Alist3r
  • 556
  • 3
  • 11
  • 27
  • Are you sure it is the IP of the server and not your connecting machine? – SilverlightFox Apr 16 '14 at 14:31
  • http://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address-in-asp-net?rq=1 – TimG Apr 16 '14 at 14:32
  • @SilverlightFox oh well, at a better look i get the ip of the default gateway – Alist3r Apr 16 '14 at 14:35
  • On local you connect to your website using localhost, ::1 is localhost. When you connect using an other PC, you'll get the IP that is used to connect (depending if you want on a LAN or outside on the internet). – the_lotus Apr 16 '14 at 14:48

0 Answers0