Windows Develop Bookmark and Share   
 index > Windows Forms General > Get global ip in winforms?
 

Get global ip in winforms?

I am working on winforms application .What i want is the global ip address is tat possible ?
  • Edited by.Net Noobler Wednesday, October 07, 2009 4:30 AMmissing content
  •  
.Net Noobler  Wednesday, October 07, 2009 4:29 AM
If you mean your remote/external IPAddress then you can use following code



Dim w As New WebClient
Dim ipAddress As String = w.DownloadString("http://www.whatismyip.com/automation/n09230945.asp")
Gaurav Khanna
  • Marked As Answer by.Net Noobler Wednesday, October 07, 2009 6:17 AM
  •  
Khanna Gaurav  Wednesday, October 07, 2009 6:05 AM
Hi,
could you please little more clear what is global ip address.
using this you can get the localIP.i hope it will help you
 String hn = Dns.GetHostName();
            IPHostEntry he = Dns.GetHostEntry(hn);
            IPAddress[] iArr = he.AddressList;
            foreach (IPAddress i in iArr)
            {
               MessageBox.Show(i.ToString());
            }

Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
Gnanadurai  Wednesday, October 07, 2009 5:29 AM
If you mean your remote/external IPAddress then you can use following code



Dim w As New WebClient
Dim ipAddress As String = w.DownloadString("http://www.whatismyip.com/automation/n09230945.asp")
Gaurav Khanna
  • Marked As Answer by.Net Noobler Wednesday, October 07, 2009 6:17 AM
  •  
Khanna Gaurav  Wednesday, October 07, 2009 6:05 AM
@thanks khanna gaurav .The link provided by you is a permanent link or some kind temporary .Coz i'm going to use in my project ....


Regards,
Rahul.
.Net Noobler  Wednesday, October 07, 2009 6:17 AM
I think it's permanent unless whatismyip.com decide to change it. But i think it would be very rare.
Gaurav Khanna
Khanna Gaurav  Wednesday, October 07, 2009 6:30 AM

You can use google to search for other answers

Custom Search

More Threads

• Printing MDI Child Form
• scroll event for treeview
• drag and drop
• Windows Form in Native Window
• concerning the "sleep" feature in windows XP
• Renaming an existing file
• Using webbrowser to display word, excel documents
• How to make windows wait for the cancel command when catching the windows shutdown event
• Bad bad memory problem
• Pdf and Windows Form