Click here to Skip to main content
12,556,726 members (52,132 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET jQuery API
Recently, I have been assigned a task to create a simple web page what will help anybody to know the availability of the domain name that he/she wants to register.

I am on a .net platform using For this task,I thought to use System.Net namespace and with the help of WebResponse and WebRequest classes I can come to know which domain is registered. But there I can come to know about only running website.

But what, if someone has registered his/er domain and not host any website yet. That could not be trace using this method.

I am looking for your valuable guidance or suggestions or any API that performs this task.

Posted 2-Dec-12 19:08pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

public static string GetSubDomainID()
           string domainID = HttpContext.Current.Request.Url.Host;
           if (domainID.Contains("/"))
               domainID = domainID.Substring(0, domainID.IndexOf("/"));
           if (domainID.ToLower().StartsWith("www."))//ignore www subdomain
               domainID = domainID.Substring(4);
           if (domainID.Contains("."))//Remove the last part i.e. organization e.g. .com / .net
               domainID = domainID.Substring(0, domainID.LastIndexOf("."));
           if (domainID.Contains("."))//Remove the second last part i.e. primary domain e.g. logisys
               domainID = domainID.Substring(0, domainID.LastIndexOf("."));
           if (domainID.Contains("."))//Get the first part
               domainID = domainID.Substring(0, domainID.IndexOf("."));
           return domainID;

try this coding to check domain availability ....

Happy coding:)
Manish Kumar Namdev 3-Dec-12 23:35pm
@Deenu India : The code you give is ok but this is not what I'm looking.
I am looking that How can I come to know if a domain is registered as gTLD or ccTLD. I am looking to register mine one. Is there any API for that?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161026.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100