Products Downloads Purchase Support Company
Home : Products : WhoIs Features

WhoIs Features

ActiveWhoIs was a product that was released separately in the past. Like DNS, we decided to integrate it into ActiveUp.MailSystem. This WhoIs component will enable any .NET developer to query a WhoIs server to check both the availability and information related to any second-level domain name (.COM, .DE, .SE, …). You can also do a Global WhoIs search that will query all specified WhoIs servers and return a collection of results with all the information you need to display or manage. 

Our component provides default WhoIs servers for each top-level domain (up to 67) and includes logic to detect the availability of those servers. You can also define your own WhoIs server list using an external XML definition file or simply add them using code in the Servers collection. 

This component is the ideal solution for an ISP or registrar that wants to provide a WhoIs gateway for their customers. The component's ability to work asynchronously makes it ideal for your Windows or web applications. Full source code is available.

The following key features are available:

WhoIs server querying

Querying the right WhoIs server implicitly based on the domain name is handled by this code:

ShowShow C# code

WhoIs whoIs = new WhoIs();

string result = whoIs.Query("example.com");

And if you want to specify the server, no problem:

ShowShow C# code

WhoIs whoIs = new WhoIs();

string result = whoIs.Query("whois.ns.example.com", 43, "example.com");

Asynchronous mode

All operations can be executed asynchronously preventing from blocking behavior of your application that may reduce usability:

ShowShow C# code

WhoIs whoIs = new WhoIs();

IAsyncResult state = whoIs.QueryAsync("activeup.com",new AsyncCallback(MyCallbackWhoIs));

public void MyCallbackWhoIs(IAsyncResult state)
{
   try
   {
      string result = whoIs.QueryAsyncResult(state);

      Console.WriteLine(result);
   }
   catch(WhoisException we)
   {
      Console.WriteLine("WhoisException : " + we.Message);
   }
   catch(Exception ex)
   {
      Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
   }
}

Domain name availability check

We also provide a parsing logic that will give you details about the availability of the specified domain name:

ShowShow C# code

try
{
   WhoIs whoIs = new WhoIs();
  
   bool result = whoIs.IsAvailable("example.com");
  
   if (result == true)
      Console.WriteLine("The domain is available for registration.");
   else
      Console.WriteLine("The domain is NOT available for registration.");
}
catch(WhoisException we)
{
   Console.WriteLine("WhoisException : " + we.Message);
}
catch(Exception ex)
{
   Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
}

Custom WhoIs server list resource file support

While we maintain the latest and official WhoIs server list, you may want to override or update our data providing your XML file definition.

ShowShow XML definition file

<?xml version="1.0" encoding="utf-8" ?>
<serverdefinition xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <host>whois.networksolutions.com</host>
      <port>43</port>
      <domain>.com</domain>
      <nomatch>no match</nomatch>
    </server>
    <server>
      <host>whois.nic.uk</host>
      <port>43</port>
      <domain>.co.uk</domain>
      <nomatch>not match</nomatch>
    </server>
  </servers>
</serverdefinition
> 

<host>
The host or IP address of the whois server. 

<port>
The port number to use for the connection. 

<domain>
The domain extention of the server. For example, '.be' for belgium, '.fr' for france,.... 

<nomatch>
String indicate the domain name doesn't exist.

To create the external xml file to use as whois servers list, you can create it manually or using serilization. This is a sample code to create this external xml file and load it.

ShowShow C# code

try
{
   ServerDefinition servers = new ServerDefinition();
   servers.Servers.Add(new Server("whois.networksolutions.com", 43, ".com", "no match"));
   servers.Servers.Add(new Server("whois.nic.uk", 43, ".co.uk", "no match"));
  
   TextWriter writer = new StreamWriter("whoisservers.xml");
   XmlSerializer serialize = new XmlSerializer(typeof(ServerDefinition));
   serialize.Serialize(writer, servers);
  
   WhoIs whoIs = new WhoIs();
   whoIs.LoadServerDefinitionFromXml("whoisservers.xml"); // load the xml external file
   string result = whoIs.Query("example.com");
 
   Console.WriteLine(result);
}
catch(WhoisException we)
{
   Console.WriteLine("WhoisException : " + we.Message);
}
catch (Exception ex)
{
   Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
}

 


 

Copyright © 2000-2007 Active Up - All Rights Reserved - Privacy Policy