Eric Bergman-Terrell's Blog

Added WHOIS Domain Registration Information Utility
October 10, 2007

I just added a WHOIS utility to the Utilities page. You can use it to look up registration information for domains.

The code for doing a WHOIS request is surprisingly simple. I used these instructions to write the code. I found a list of WHOIS servers here. I found that sometimes the WHOIS requests would take a very long time, so I added send and receive timeouts to the code. Before I did that, I noticed that if I had only a small number of the WHOIS pages waiting for results, my website would stop serving up any page. I imagine that my hosting provider only provides a small number of threads to each web application. Perhaps in the future I'll rewrite the page as an ASP.NET 2.0 asynchronous page.

Note: Many of the servers in the list don't work, and some of them serve up strange WHOIS data for popular domains such as microsoft.com. By strange I mean WHOIS data plus URLs to suspicious websites, unflattering references to the domain owner, and profanities. Fair warning: once you find a WHOIS server that works, test some popular domains to ensure that the data that comes back is legit. Here is a blog post that describes how the strange content gets into the WHOIS data.

// http://www.aspdev.org/articles/build-whois-lookup-asp.net/
private string Whois(string domain)
{
    string serverResponse = null;

    string whoisServer = ConfigurationManager.AppSettings["WHOISServer"];

    using (TcpClient objTCPC = new TcpClient())
    {
        objTCPC.SendTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["WHOISSendTimeout"]); 
        objTCPC.ReceiveTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["WHOISReceiveTimeout"]);

        objTCPC.Connect(whoisServer, 43);

        string strDomain = string.Format("{0}\r\n", domain);

        byte[] arrDomain = Encoding.ASCII.GetBytes(strDomain);

        using (Stream objStream = objTCPC.GetStream())
        {
            objStream.Write(arrDomain, 0, strDomain.Length);

            using (StreamReader objSr = new StreamReader(objTCPC.GetStream(), Encoding.ASCII))
            {
                serverResponse = objSr.ReadToEnd();
            }
        }
    }

    if (serverResponse == null)
    {
        serverResponse = string.Empty;
    }
    else
    {
        serverResponse = serverResponse.Trim();
    }

    return serverResponse;
}

I wrote a program that automatically issued WHOIS requests to all the servers in the list of WHOIS servers, and determined the subset of servers that returned results without exceptions being thrown (see below).

For the WHOIS utility I chose one of the servers that returned good results. It's configured in my web.config in case I need to change it in the future.

whois.discount-domain.com
dns411.com
whois.domaindiscover.com
whois.domainpeople.com
whois.easyspace.com
whois.enom.com
whois.geektools.com
whois.internetnamesww.com
whois.names4ever.com
whois.namesecure.com
whois.networksolutions.com
whois.register.com
whois.berkeley.edu
whois.cwru.edu
mit.edu
whois.ncsu.edu
whois.sdsu.edu
directory.ucdavis.edu
ucsd.edu
umn.edu
netlib2.cs.utk.edu
wisc.edu
whois.hq.nasa.gov
x500.ivv.nasa.gov
whois.jpl.nasa.gov
whois.larc.nasa.gov
whois.nic.gov
whois.abuse.net
whois.aco.net
whois.apnic.net
whois.arin.net
whois.aunic.net
whois.awregi
whois.corenic.net
whois.crsnic.net
whois.hinet.net
whois.internic.net
whois.ja.net
whois.krnic.net
whois.netnames.net
whois.nsiregistry.net
whois.oleane.net
whois.opensrs.net
whois.ra.net
whois.ripe.net
whois.ripn.net
whois.thnic.net
whois.twnic.net
whois.dhs.org
whois.nic.ac
whois.nic.am
whois.nic.as
whois.connect.com.au
whois.registro.br
whois.queensu.ca
whois.nic.cc
whois.nic.ch
whois.nic.ck
whois.nic.cl
whois.cnnic.net.cn
whois.cuni.cz
whois.mff.cuni.cz
whois.nic.de
whois.nic.fr
whois.hknic.net.hk
whois.nic.it
whois.nic.mx
whois.nic.ad.jp
whois.nic.or.kr
whois.nic.li
whois.norid.no
whois.nic.nu
whois.domainz.net.nz
whois.dns.pt
whois.nic-se.se
whois.nic.net.sg
whois.nic.sh
whois.nic.st
whois.adamsnames.tc
whois.tonic.to
whois.metu.edu.tr
whois.nic.uk
Keywords: CAPTCHA, ASP.NET 2.0, website image manipulation, security, WHOIS, DNS, website registration information

Reader Comments

Comment on this Blog Post

Recent Posts

TitleDate
Java Programming Tip: SWT Photo Frame ProgramOctober 31, 2016
Vault 3 (Desktop) Version 1.63 ReleasedSeptember 9, 2016
"Compliance with Court Orders Act of 2016"April 9, 2016
Disable "Visual Voicemail" on Android / T-MobileJanuary 17, 2016
IPv6 HumorDecember 10, 2015
Java Programming Tip: Specify the JVM time zoneDecember 7, 2015
Node.js / Express Programming Tip: Detect and Fix Memory LeaksOctober 27, 2015