Translating or converting a Hostname to an IP Address using C#.

Posted by vishalneeraj-24503 under C# category on | Points: 40 | Views : 914
If we need to translate a hostname(for ) to its IP Address,then we can use the classes as Dns and IPAddress to do it.

using System.Net;
private static void Main(string[] args)
string website = "";
IPAddress[] addresses = Dns.GetHostAddresses(website);

foreach (var address in addresses)

Comments or Responses

Login to post response