Get Ip

ADO DOT NET

Well-known member
Joined
Dec 20, 2006
Messages
156
Hi,
In VB6 I was getting the users IP by placing a winsock control on the form and : Winsock1.LocalIP
Now in .NET how can I get the IP address of machine?
Thanks:)
 
Code:
Dim ip As System.Net.IPAddress
ip = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList(0)
should do the trick, if you have more than one ip address though you will need to loop through the AddressList to find them all.
 
Back
Top