Question

Is there a free/open source tool to verify wether a domain exists in c#? I ve a textbox where my user can enter his domain name and list of radio buttons like .com,.net,.in etc... Any suggestion..

Is there any webservice that does it?

EDIT : I need to check only the domain name availability.. Any ideas...

Was it helpful?

Solution

It's built into the .net Framework:

var server = Dns.Resolve("www.stackoverflow.com");

OTHER TIPS

public bool isDomainExist(string address)
{
    System.Net.WebRequest request = System.Net.WebRequest.Create(address);
    request.Method = "HEAD";
    try
    {
        var r = request.GetResponse();
        return true;
    }
    catch (Exception ex)
    {
        return false;
    }
}

console.writeline(isDomainExist("https://stackoverflow.com"));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top