How to Get IP Address using Host Name


You want to get the IP Address of a given host name, you can use System.Net.Dns.GetHostAddresses method that returns System.Net.IPAddress array.

System.Net.IPAddress[] IPAddresses = System.Net.Dns.GetHostAddresses("mail.yahoo.com");

ListBox1.DataSource = IPAddresses;
ListBox1.DataBind();

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments