Last active
September 17, 2015 17:02
-
-
Save vkbandi/49f08f55c02fad0c0244 to your computer and use it in GitHub Desktop.
A simple C# class for demonstrating the use of whois to check the availability of a domain name - code snippet for coderbuddy.wordpress.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DomainSearch | |
{ | |
/// <summary> | |
/// Check whether a given domain name is available or not | |
/// </summary> | |
/// <param name="domainName">domain name to be verified</param> | |
/// <returns></returns> | |
public static bool IsDomainNameAvailable(string domainName) | |
{ | |
string whoisData = Whois.Lookup(domainName); | |
string[] ws = whoisData.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); | |
return ws[7].Contains("No match for domain \"" + domainName.ToUpper() + "\"."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code uses the Whois.cs code snippet. you can find more info about this code on my blog