How do you resolve a domain name to an IP address with .NET/C#? *

Question

How do you resolve a domain name to an IP address with .NET/C#?

Answer

using System.Net;

foreach (IPAddress address in Dns.GetHostAddresses("www.google.com"))
{
   Console.WriteLine(address.ToString());
}
< br > via < a class="StackLink" href=" http://stackoverflow.com/questions/4816/" >How do you resolve a domain name to an IP address with .NET/C#?< /a>
Share on Google Plus

About Cinema Guy

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment