Tools Used : Visual C# .NET
The .Net DNS class can be used to get a host name or an IP of a given host name. To use DNS class in your project, you need to include System.Net
Include System.Net Reference
And say I want to get IP address if www.mindcracker.com. The given code will do that for you.
using System;
using System.Net;
namespace DNSName
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
static void Main(string[] args)
{
IPHostEntry ipEntry = Dns.GetHostByName (http://www.mindcracker.com/);
IPAddress [] IpAddr = ipEntry.AddressList;
for (int i = 0; i < IpAddr.Length; i++)
{
Console.WriteLine ("IP Address {0}: {1} ", i, IpAddr[i].ToString ());
}
}
}
}
Get Local System's host name and IP
Use GetHostName with no parameter to return the host name of a local machine. Once you have host name, pass this host name as a parameter in GetHostByName. See above.
string strHostName = Dns.GetHostName ();

Vithal WadjeTOP 100Posted Nov 23, 2014, 7:13 AM EST
very useful,thanks for sharing
Manav SainieditedPosted Jul 30, 2011, 1:00 AM EDTEdited Jul 30, 2011, 1:10 AM EDT
sir, when i enter IPHostEntry ipEntry = Dns.GetHostByName (http://www.mindcracker.com/); due to // symbol all the character become comment and error come=ëxpected ) and ;" how to resolve this problem
kishore IrahPosted Mar 26, 2007, 3:58 AM EDT
could you help me out by providing the code for developing an application for collecting information from remote servers using Asp.net and code behind is VB.NET help me on solving this problem? Thanks in advance... kishore