Reputation: 4790
How do you resolve a domain name to an IP address with .NET/C#?
Upvotes: 30
Views: 6557
Reputation: 25052
using System.Net;
foreach (IPAddress address in Dns.GetHostAddresses("www.google.com"))
{
Console.WriteLine(address.ToString());
}
Upvotes: 20