HighTechTalks DotNet Forums  

public ip address

VB.net microsoft.public.dotnet.languages.vb


Discuss public ip address in the VB.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
karim
 
Posts: n/a

Default public ip address - 01-20-2010 , 11:31 PM






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.GetV alue(0)

Any ideas would be appreciated.

Reply With Quote
  #2  
Old   
Onur Güzel
 
Posts: n/a

Default Re: public ip address - 01-21-2010 , 02:52 AM






On Jan 21, 7:31Â*am, karim <ka... (AT) discussions (DOT) microsoft.com> wrote:
Quote:
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.GetV alue(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

Reply With Quote
  #3  
Old   
Armin Zingler
 
Posts: n/a

Default Re: public ip address - 01-21-2010 , 03:04 AM



karim schrieb:
Quote:
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.GetV alue(0)

Any ideas would be appreciated.
Not exactly the same question, but...:
http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/398ad127e5be920d

Don't know which of the IPs you consider "public".

--
Armin

Reply With Quote
  #4  
Old   
karim
 
Posts: n/a

Default Re: public ip address - 01-21-2010 , 04:06 AM



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?

Reply With Quote
  #5  
Old   
karim
 
Posts: n/a

Default Re: public ip address - 01-21-2010 , 04:11 AM



Never mind, I did this and it worked... Thank you very much

lblPIp.Text =
(client.DownloadString("http://www.whatismyip.com/automation/n09230945.asp")

Reply With Quote
  #6  
Old   
Onur Güzel
 
Posts: n/a

Default Re: public ip address - 01-21-2010 , 04:23 AM



On Jan 21, 12:11*pm, karim <ka... (AT) discussions (DOT) microsoft.com> wrote:
Quote:
Never mind, I did this and it worked... Thank you very much

lblPIp.Text =
(client.DownloadString("http://www.whatismyip.com/automation/n09230945.asp")
Glad it worked, cheers.

Onur Güzel

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.