![](https://images.cnblogs.com/cnblogs_com/shuang121/yuming.jpg)
![](https://images.cnblogs.com/cnblogs_com/shuang121/yy.jpg)
关键代码:
public string Lookup(string strDomain)
{
try
{
string result = "";
string server = "whois.internic.net";
string ext = ".com";
int port = 43;
int address = -1;
string domain = strDomain.Trim().ToLower();
if (domain.StartsWith("www."))
{
domain = domain.Substring(4, domain.Length - 4);
}
if (domain == "" || domain.IndexOf(",") != -1 || domain.IndexOf(";") != -1 || domain.IndexOf("_") != -1 || domain.IndexOf(".") == -1)
{
result = "Please enter a valid domain name.";
}
else
{
address = domain.IndexOf(".");
ext = domain.Substring(address);
switch (ext)
{
case ".com":
case ".net":
case ".org":
default:
server = "whois.crsnic.net";
//server="whois.internic.net";
break;
case ".biz":
case ".info":
case ".mil":