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

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)
 
C

CJ Taylor

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
 
T

Trint Smith

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

.Net programmer
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top