0

So basically I'm wanting to find out how someone might check domain name availability without using existing web services already out there. I found a bunch of solutions online that I could integrate into my own project that will do this, but in the raw sense, how does one go about this from scratch?

I don't want to have to rely on something someone else created to return whether or not a domain name is available- essentially, I want to design my own.

So,

  1. What goes on behind the scenes when someone queries a domain name to see if it exists?
  2. And can you point me in the right direction on how to implement this using C#?

Thanks a lot guys.

Mike

blowdart
  • 55,577
  • 12
  • 114
  • 149
Mike Marks
  • 10,017
  • 17
  • 69
  • 128
  • I'm a little unsure as to what you're asking. You don't want to _ever_ have to go through someone else's service? At some point you're going to have to, because you aren't the authority on domains. It's like asking to find the IP address of a website without having to go through anyone else's DNS. If you're okay relaxing your restrictions a little, look at things like whois, or a quick search returns this [API](http://internetbs.net/ResellerRegistrarDomainNameAPI/api/01_domain_related/01_domain_check) – Greg Jackson Jun 20 '11 at 16:14
  • [Here](http://www.aspdev.org/articles/build-whois-lookup-asp.net/) is a guide to make a WHOIS-Lookpup to check whether a domain is registered or not. Only commented because you wanted to know a way to do it completely by yourself. You could handle a "Page not found" error, but that wouldn't work if the page is only offline for maintenance or network problems. – Tim Schmelter Jun 20 '11 at 16:17

2 Answers2

3

The way to do this is try to perform a WHOIS lookup on the domain name. This used to be simple - there was a fixed list of whois servers for each suffix (.com, .net, .uk, .ca etc.) and you would select the right server, telnet on port 43 and ask for the registration information.

However in real life it's not that simple any more. .com has multiple whois servers, when you lookup a .com you get a forwarding hint you need to search for and follow. The response from a whois server is not a fixed or standardised format, so you need to parse on a per server basis. Some suffixs use rwhois, some only allow you to query via the web. Some domains (.cn and .uk are the ones I remember) have different whois servers for different domain types (for example ac.cn has it's own whois server, which is different to the .ca server).

It is painful to do. This will give you a starting point for c#, but it doesn't do forwarding. The jwhois source will give you an idea of special cases.

blowdart
  • 55,577
  • 12
  • 114
  • 149
  • Old answer, but https://registrar-console.centralnic.com/pub/whois_guidance says "Use of the Whois for perfoming domain name availability checks is STRONGLY DISCOURAGED. " – ave Mar 14 '16 at 21:34
1

You need use "whois" request.

Samples for C#:

TcKs
  • 25,849
  • 11
  • 66
  • 104