要實現域名查詢
網址為
whois
輸入中文域名後查詢界面
判斷是否為中文域名(javascript)
function IsChDomain(domainStr)
{
var flag = false;
var compStr =
var domainLength = domainStr
for(var i =
{
var temp = domainStr
if(temp >=
{
flag=true;
}
else
{
var temp
if(temp
{
flag = false;
break;
}
}
}
return flag;
}
輸入英文域名後查詢界面
判斷是否為英文域名
function IsEnDomain(domainStr)
{
var flag = false;
var compStr =
var domainLength = domainStr
for(var i =
{
if(compStr
{
flag = false;
break;
}
else
{
flag = true;
}
}
return flag;
}
中國等不能注冊英文域名
function Trim(domainStr)
{
return domainStr
}
function checkValue()
{
if(document
{
alert(
return false;
}
if(document
{
alert(
return false;
}
for(var i =
{
if(document
{
alert(
return false;
break;
}
}
checkDomainType();
return true;
}
function checkDomainType()
{
var domainName = document
domainName = Trim(domainName);
if(IsChDomain(domainName))
{
setCheckBox(true);
}
else if(IsEnDomain(domainName))
{
setCheckBox(false);
}
}
function setCheckBox(flag)
{
document
document
document
document
document
document
document
document
document
document
document
}
查詢結果界面
例如查詢域名
網址為
返回的信息為XML格式
<?xml version=
<property>
<returncode>
<key></key>
<original>
</property>
其中
因此可通過判斷original 後的代碼是否為
判斷方法有多種
在這用的是解析XML方法
獲取待查詢的域名
string domainName = Common
if (domainName == string
{
lblMsg
return;
}
IList<string> domainList = new List<string>();//保存域名名稱和後綴
domainList
if (chkcom
if (chknet
if (chkbiz
if (chkcc
if (chktv
if (Utility
{
if (chkchina
if (chkcompany
if (chknetwork
if (chkcn
}
else
{
if (chkorg
if (chkorgcn
if (chkcomcn
if (chknetcn
if (chkgovcn
if (chkmobi
if (chkinfo
}
Session[
Response
判斷是否為中文域名(方法)
public static bool IsHasCHZN(string domainName)
{
Regex RegCHZN = new Regex(
Match m = RegCHZN
return m
}
判斷域名是否被注冊(方法)
/// ** (C#) 實現域名查詢**
///
/// File: CommonOperate
///
/// Author: 周振興 (Zxjay 飄遙)
///
/// E
///
/// Date:
///
/// Blog:
public static bool IsReg(string domainName)
{
bool flag = false;
string dm = HttpContext
try
{
//判斷方法非常多
WebClient wc = new WebClient();
string xmlstr = wc
area_domain=
StringReader sr = new StringReader(xmlstr);
XmlTextReader xr = new XmlTextReader(sr);
while (xr
{
if (xr
{
xr
if (xr
{
flag = true;
break;
}
else
{
flag = false;
break;
}
}
}
return flag;
}
catch
{
return false;
}
}
顯示域名查詢情況
if (Session[
{
IList<string> il = (IList<string>)Session[
if (il
{
string dm = il[
string dname;
Label lbl;
for (int i =
{
dname = dm + il[i];
if (Utility
{
lbl = new Label();
lbl
lbl
float:left;clear:left;
color:#ff
pnlDomainName
}
else
{
lbl = new Label();
lbl
lbl
float:left; clear:left;
</div>
dm + il[i]
pnlDomainName
}
}
}
}
(
(
(
From:http://tw.wingwit.com/Article/program/net/201311/13950.html