public ip address

K

karim

Hi,
I'm using vb08 and I'm trying to get the public ip address. I used this code
but for some reason it's not working:
Dim lblPIp As IPAddress
lblPIp = Dns.GetHostEntry(Dns.GetHostName).AddressList.GetValue(0)

Any ideas would be appreciated.
 
O

Onur Güzel

Hi,
I'm using vb08 and I'm trying to get the public ip address. I used this code
but for some reason it's not working:
Dim lblPIp As IPAddress
        lblPIp = Dns.GetHostEntry(Dns.GetHostName).AddressList.GetValue(0)

Any ideas would be appreciated.

Hi,

That can be retrieved using a a 3rd-party IP detection web server
cınbined with WebClient object:

Using client As New System.Net.WebClient
' Get it in MsgBox
MsgBox(client.DownloadString _
("http://www.whatismyip.com/automation/n09230945.asp"))
End Using

Onur Güzel
 
K

karim

Thank you Onur Güzel, works great. But would I be able to view the ip
address in a label/text box instead of a message?
 

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