Tuesday, October 21, 2008

Get WebSite IP details in C#.NET

// Include System.NET
IPHostEntry ip = Dns.GetHostByName("www.testsitename.com");

IPAddress [] IPDetails=ip.AddressList;

for (int i = 0; i < IPDetails.Length; i++)
{
Response.Write("IP Address :"+ IPDetails[i].ToString());
}
string [] ipHost = ip.Aliases;

for (int i = 0; i < ipHost.Length; i++)
{
Response.Write("
Aliase Name :" + ipHost[i].ToString());
}

No comments: