Can you fix this code to get web visitors IP address?

  • Thread starter Thread starter Trint Smith
  • Start date Start date
T

Trint Smith

This code only gets the ip address of the server it is on and I want it
to get viewers of the site's ip:
Dim hostaddr As IPAddress
Dim strhost As String
Dim writeToo As String

strhost = Dns.GetHostName
hostaddr = Dns.Resolve(strhost).AddressList(0)
writeToo = hostaddr.ToString

Any help is appreciated.
Thanks,
Trint

.Net programmer
(e-mail address removed)
 
Trint.

Nice thinking, wrong route though. This will get you the local machine
address..

Try somtehing like

Dim ipAddr as String

ipAddr = Request.UserHostAddress

I think you'll have better luck =)

-CJ
 
CJ,
Thanks. That worked (as you knew it would).
Trint

.Net programmer
(e-mail address removed)
 
Back
Top