How to get Ip of Url in c#

by Ali Raza Zaidi on November 20, 2007

Here is sample code  remember to add system.net namespace

IPHostEntry ip = Dns.GetHostByName (“www.yahoo.com”);
IPAddress [] IpA = ipE.AddressList;
for (int i = 0; i < IpA.Length; i++)
{
    Console.WriteLine (“IP Address {0}: {1} “, i, IpA[i].ToString ());
}

Comments on this entry are closed.

Previous post:

Next post: