From: karim on 21 Jan 2010 00:31 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.
From: Onur Güzel on 21 Jan 2010 03:52 On Jan 21, 7:31 am, karim <ka...(a)discussions.microsoft.com> wrote: > 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
From: Armin Zingler on 21 Jan 2010 04:04 karim schrieb: > 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. 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
From: karim on 21 Jan 2010 05:06 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?
From: karim on 21 Jan 2010 05:11 Never mind, I did this and it worked... Thank you very much lblPIp.Text = (client.DownloadString("http://www.whatismyip.com/automation/n09230945.asp")
|
Next
|
Last
Pages: 1 2 Prev: Extending a RichTextBox Next: Override function Key F4 to show combobox dropdown list |