ali raza

C#, .Net ,Asp.net and my thoughts

How to get Ip of Url in c#

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 ());
}

3 responses to “How to get Ip of Url in c#

  1. blackjack July 17, 2008 at 6:11 am

    GetHostByName is obsolete in .NET 2.0. Use GetHostEntry instead.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: