Tuesday, January 14, 2014

Convert IP Address into Url

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("109.73.164.17");
IPHostEntry entry = Dns.GetHostEntry(addr);
Response.Write(entry.HostName.ToString());

entry.HostName.ToString() will return the host name of the ip address.


Download the code here.




0 comments:

Post a Comment

Follow by Email

Popular Posts

Pageviews