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 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.

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;
        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.
Keywords: CAPTCHA, ASP.NET 2.0, website image manipulation, security, WHOIS, DNS, website registration information

Reader Comments

Comment on this Blog Post

Recent Posts

EBTCalc Users: A Desktop Version is Now Available!October 25, 2019
Python Script to Audit MediaMonkey TranscodingAugust 15, 2019
How to decompile Java code with JetBrains IntelliJ IDEA (2018.2.3, Windows 10)October 5, 2018
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