Sometimes developers need IP address of website hosting server. The below code will help software developer to find out all the IP address associated with website. Do noty forget to include System.Net namespace.
C# Program to get IP Address:
using System;
using System.Net;
namespace MyApp
{
class Pascal_class
{
static void Main()
{
string Website1 = "www.SoftwareTestingNet.com";
string Website2 = "www.BharatClick.com";
IPAddress[] ip_Addresses = Dns.GetHostAddresses(Website1);
foreach (IPAddress my_address in ip_Addresses)
{
Console.WriteLine("www.SoftwareTestingNet.com Address: {0}", my_address);
}
ip_Addresses = Dns.GetHostAddresses(Website2);
foreach (IPAddress my_address in ip_Addresses)
{
Console.WriteLine("www.BharatClick.com Address: {0}", my_address);
}
Console.Read();
}
}
}
No comments:
Post a Comment