Search code examples
c#ip-address

C#: Get IP Address from Domain Name?


How can I get an IP address, given a domain name? For example: www.test.com


Solution

  • You can use the System.Net.Dns class:

    Dns.GetHostAddresses("www.test.com");