Querying WHOIS datbases int ASP.NET


A while back I was involved in developing a web site for a Domain and Hosting reseller. In that project I needed to create a “Find A Domain”  section in which the customer could check to see if a domain name exists.

I made a exhaustive research and figured out that each Who is server maintains a list of certain domain types. For example,  Whois.net can whois only .COM, .NET and .ORG domains.

Many posts over the internet, including blogs.msdn.com,  also says that to query a who is database one should connect to the whois server through a TCP/IP conenction (usually via port 43).

All the above issues make Whois action fairly difficult to perform. Luckily, today I came across a very nice web site which provides a Whois SOAP web service.  To see the details of the service check this link:

http://www.webservicex.net/whois.asmx?op=GetWhoIS

This web service searches all the who is databases to look up the domain name you provide. Therefore, you will not need to search several who is databases.

To Whois a domain name, you should pass a ‘hostname’ parameter to the service:

http://www.webservicex.net/whois.asmx?Hostname=Microsoft.com

You can use this web service simply via a GET or a POST method as well as making a reference to it via Visual Studio and call its GetWhoIS metho. As I mentioned in the previous post (about REST web services), I prefer to get the who is answer using XElement.Load method. For example we may write the following method for whoising:

public static string WhoIs(string hostname)
{
XElement WhoisResult = XElement.Load(

http://www.webservicex.net/whois.asmx/GetWhoIS?HostName=microsoft.com”);
return WhoisResult.ToString();
}

Each Who is server returns a different response. Therefore, to develop a method which indicates wheather a domain name exits or not, we should look for a common string value in the WhoIS response. For example the ‘NAME SERVER’ seems to be a common string. There fore, a domain lookup function can be written this way:

public static bool IsDomainTaken(string hostname)
{
return WhoIs(hostname).ToUpper().Contains(“NAME SERVER”);
}

As I told you, this web service seems to query several WhoIS server, thus the GetWhoIS method is a little bit time consuming.

P.S. Try to Whois Microsoft.com, the result is pretty funny:

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered

with many different competing registrars. Go to http://www.internic.net

for detailed information.

MICROSOFT.COM.ZZZZZZ.MORE.DETAILS.AT.WWW.BEYONDWHOIS.COM

MICROSOFT.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM

MICROSOFT.COM.ZZZZZ.DOWNLOAD.MOVIE.ONLINE.ZML2.COM

MICROSOFT.COM.ZZZOMBIED.AND.HACKED.BY.WWW.WEB-HACK.COM

MICROSOFT.COM.ZZZ.IS.0WNED.AND.HAX0RED.BY.SUB7.NET

MICROSOFT.COM.WILL.LIVE.FOREVER.BECOUSE.UNIXSUCKS.COM

MICROSOFT.COM.WILL.BE.SLAPPED.IN.THE.FACE.BY.MY.BLUE.VEINED.SPANNER.NET

MICROSOFT.COM.WILL.BE.BEATEN.WITH.MY.SPANNER.NET

MICROSOFT.COM.WAREZ.AT.TOPLIST.GULLI.COM

MICROSOFT.COM.TOTALLY.SUCKS.S3U.NET

MICROSOFT.COM.SOFTWARE.IS.NOT.USED.AT.REG.RU

MICROSOFT.COM.SHOULD.GIVE.UP.BECAUSE.LINUXISGOD.COM

MICROSOFT.COM.RAWKZ.MUH.WERLD.MENTALFLOSS.CA

MICROSOFT.COM.OHMYGODITBURNS.COM

MICROSOFT.COM.MORE.INFO.AT.WWW.BEYONDWHOIS.COM

MICROSOFT.COM.LOVES.ME.KOSMAL.NET

MICROSOFT.COM.LIVES.AT.SHAUNEWING.COM

MICROSOFT.COM.IS.NOT.YEPPA.ORG

MICROSOFT.COM.IS.NOT.HOSTED.BY.ACTIVEDOMAINDNS.NET

MICROSOFT.COM.IS.IN.BED.WITH.CURTYV.COM

MICROSOFT.COM.IS.HOSTED.ON.PROFITHOSTING.NET

MICROSOFT.COM.IS.GOD.BECOUSE.UNIXSUCKS.COM

MICROSOFT.COM.IS.A.STEAMING.HEAP.OF.FUCKING-BULLSHIT.NET

MICROSOFT.COM.IS.A.MESS.TIMPORTER.CO.UK

MICROSOFT.COM.HAS.ITS.OWN.CRACKLAB.COM

MICROSOFT.COM.HAS.A.PRESENT.COMING.FROM.HUGHESMISSILES.COM

MICROSOFT.COM.FILLS.ME.WITH.BELLIGERENCE.NET

MICROSOFT.COM.CAN.GO.FUCK.ITSELF.AT.SECZY.COM



Bye for now.


Advertisements

14 thoughts on “Querying WHOIS datbases int ASP.NET

  1. Your style is very unique in comparison to other people I have read stuff from.
    I appreciate you for posting when you have the opportunity, Guess I’ll just book mark this web site.

  2. If not, then just buy your friends and family their very own pair.

    There are many websites that offer them for free and you can easily find lots of them.
    Imagine this scenario: You are hanging out with a group
    of your friends, having a good time, and then oops.

  3. Thanks for your marvelous posting! I quite enjoyed reading it, you can be a great author.
    I will make certain to bookmark your blog and will eventually
    come back sometime soon. I want to encourage yourself
    to continue your great job, have a nice weekend!

  4. Thanks for your personal marvelous posting! I seriously enjoyed
    reading it, you are a great author. I will remember to bookmark your blog
    and will eventually come back later on. I want to encourage you to definitely continue your great posts, have a nice day!

  5. It’s been said that those with minimal computer experience are also
    able to sell on e – Bay, without any problems. and telling them
    the item has shipped and providing them with an estimate on once
    the package should arrive. A photo-realism close-up of a cows deal with, that on close examination you can appreciate is an incredibly skilled essential oil painting.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s