Question

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

Was it helpful?

Solution

using System.Net;

foreach (IPAddress address in Dns.GetHostAddresses("www.google.com"))
{
   Console.WriteLine(address.ToString());
}

OTHER TIPS

Try using the System.Net.Dns class

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top