To convert an IP (Internet protocol) address into corresponding Url (Uniform Resource Locator) in C#, ASP.NET you need a help of IPHostEntry and IPAddress class. Make an object of this call and call the Dns.GetHostEntry() class to find the HostName against the Url.
IPAddress addr = IPAddress.Parse("195.175.254.2");
IPHostEntry entry = Dns.GetHostEntry(addr);
Response.Write(entry.HostName.ToString());
entry.HostName.ToString() will return the host name of the IP address.
IPAddress addr = IPAddress.Parse("195.175.254.2");
IPHostEntry entry = Dns.GetHostEntry(addr);
Response.Write(entry.HostName.ToString());
entry.HostName.ToString() will return the host name of the IP address.
0 comments:
Post a Comment