Following is a simple console program which checks whether if the domain name exists or not.
You can convert it into a webservice if you wish to.
using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
namespace DemoDNS
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter a domain for lookup.");
var domainName = Console.ReadLine();
try
{
var ipAddress = Dns.GetHostEntry(domainName);
if (ipAddress.AddressList.Count() > 0)
{
Console.WriteLine("The domain already exists!");
}
}
catch (SocketException e)
{
Console.WriteLine(e.Message);
}
}
}
}