I want to get domain name from a given IP. E.g If I give IP as \"172.24.17.85\" I should get only domain name like my domain name is sonata.net.
Any code snippet for
Have you tried Dns.GetHostEntry?
Example:
using System;
using System.Net;
class Test
{
static void Main(string[] args)
{
IPAddress addr = IPAddress.Parse("69.59.196.211");
IPHostEntry entry = Dns.GetHostEntry(addr);
Console.WriteLine(entry.HostName); // Prints "stackoverflow.com"
}
}
Note that this didn't work for the example you gave... if a reverse DNS lookup doesn't work, I'm not sure what you can do.