How do you resolve a domain name to an IP address with .NET/C#?
Asked
Active
Viewed 6,228 times
2 Answers
20
using System.Net;
foreach (IPAddress address in Dns.GetHostAddresses("www.google.com"))
{
Console.WriteLine(address.ToString());
}
![](../../users/profiles/427309.webp)
Richard J. Ross III
- 53,315
- 24
- 127
- 192
![](../../users/profiles/275.webp)
lubos hasko
- 23,934
- 10
- 52
- 61