How do you resolve a domain name to an IP address with .NET/C#?
-
08-06-2019 - |
Question
How do you resolve a domain name to an IP address with .NET/C#?
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