.NET WHOIS is a drop-in library that enables you to query WHOIS information for domain registrations in .NET projects. The library doesn't have any dependencies and returns an object representing the WHOIS data.
You can install the library via the NuGet GUI or by entering the following command into the Package Manager Console:
Install-Package Whois
The source code is available on Github and can be downloaded and compiled.
To use the library, reference it in your project and then use the following code:
using namespace Whois;
var whois = new WhoisLookup().Lookup("github.com");
Console.WriteLine(whois.ToString());
The library works by querying [CenterGate’s whois-servers.net] 1 in order to find the correct WHOIS server for the TLD. The TLD WHOIS server is then queried in order to get the WHOIS information for the domain. Queries to WHOIS servers are made using TCP.
As WHOIS data is returned in free text format, custom Visitor classes need to be written to extract information and return it in a structured format. Currently only the registration date is returned for a number of registrars, however this can easily be extended by writing new visitors.
Further details about how the library works can be found on [this blog post] 2.