首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

搜索域名是否被注册解决方案

2012-01-15 
搜索域名是否被注册要求和这个网站http://www.onlinenic.com/chinese/chk_domain.html实现的功能一样,求代

搜索域名是否被注册
要求和这个网站http://www.onlinenic.com/chinese/chk_domain.html
实现的功能一样,求代码……

语言C#

[解决办法]
贴错了,上面是asp的你可用HttpWebRequest对象来实现
[解决办法]
用你那个查了一下
我苦想的2个域名原来都被注册了
[解决办法]
一个是sina翻过来 anis
一个是古龙(骨龙SkeletonDragon) 反过来 dragonSkeleton
一个是 四大恶人 4evil.com
[解决办法]
<form id= "Form1 " action= "re.aspx " runat= "server ">
域名: www. <Asp:TextBox id= "txtDomain1 " value= " " runat= "server " />
<Asp:RadioButton id= "txtDomain2 " GroupName= "RadioGroup1 " text= ".com " checked= "True " runat= "server " />
<Asp:RadioButton id= "txtDomain3 " GroupName= "RadioGroup1 " text= ".Net " runat= "server " />
<Asp:RadioButton id= "txtDomain4 " GroupName= "RadioGroup1 " text= ".org " runat= "server " />
<Asp:RadioButton id= "txtDomain5 " GroupName= "RadioGroup1 " text= ".biz " runat= "server " />
<Asp:RadioButton id= "txtDomain6 " GroupName= "RadioGroup1 " text= ".cc " runat= "server " />
<Asp:RadioButton id= "txtDomain7 " GroupName= "RadioGroup1 " text= ".cn " runat= "server " />
<Asp:Button id= "btnQuery " OnClick= "doQuery " text= "查询 " runat= "server " />
<BR> <HR width= "100% "> <BR>
<Asp:label id= "txtResult " ForeColor= "#0000FF " class= "body " runat= "server " />
</form>


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using System.Net.Sockets;
using System.Net;

public partial class Whois : System.Web.UI.Page
{
String strDomain;
String strServer;
//http://www.china-channel.com/
//whois.pir.org/
//whois.uwhois.com
//whois.internic.net
//whois.crsnic.net
string strserver1 = "whois.uwhois.com ";
string strserver2 = "whois.cnnic.net.cn ";
public void doQuery(Object sender, EventArgs e)
{
if (txtDomain2.Checked)
{
strServer = strserver1;
strDomain = txtDomain1.Text + txtDomain2.Text;
}
if (txtDomain3.Checked)
{
strServer = strserver1;
strDomain = txtDomain1.Text + txtDomain3.Text;

}
if (txtDomain4.Checked)
{
strServer = strserver1;
strDomain = txtDomain1.Text + txtDomain4.Text;
}
if (txtDomain5.Checked)
{
strServer = strserver1;
strDomain = txtDomain1.Text + txtDomain5.Text;
}
if (txtDomain6.Checked)
{
strServer = strserver1;
strDomain = txtDomain1.Text + txtDomain6.Text;
}
if (txtDomain7.Checked)


{
strServer = strserver2;
strDomain = txtDomain1.Text + txtDomain7.Text;
}
String strResponse;
bool bSuccess = DoWhoisLookup(strDomain, strServer, out strResponse);
if (bSuccess)
{
txtResult.Text = strResponse;
}
else
{
txtResult.Text = "查询失败!请重试。 ";
}
}

public bool DoWhoisLookup(String strDomain, String strServer, out String strResponse)
{
strResponse = "none ";
bool bSuccess = false;

TcpClient tcpc = new TcpClient();
tcpc.Connect(strServer, 43);
strDomain += "\r\n ";
Byte[] arrDomain = Encoding.UTF8.GetBytes(strDomain.ToCharArray());
try
{
Stream s = tcpc.GetStream();
s.Write(arrDomain, 0, strDomain.Length);

StreamReader sr = new StreamReader(tcpc.GetStream(), Encoding.UTF8);
StringBuilder strBuilder = new StringBuilder();
while (-1 != sr.Peek())
{
strBuilder.Append(sr.ReadLine() + " <br> ");
}
tcpc.Close();

bSuccess = true;
strResponse = strBuilder.ToString();
if (strResponse.IndexOf( "No match ") > 0)
{
Response.Write( "恭喜你,该域名还未注册! ");
}
if (strResponse.IndexOf( "no matching ") > 0)
{
Response.Write( "恭喜你,该域名还未注册! ");
}
else
{
Response.Write( "此域名已被注册! ");
}
}
catch (Exception e)
{
strResponse = e.ToString();
}

return bSuccess;
}


}



[解决办法]
顶一下,不过要把搂主页面上的哪些域名都查全,估计不好写。
[解决办法]
没用过。不懂。学习一下。
[解决办法]
不懂,帮顶!关注!学习!!
[解决办法]
都是好人啊。。~ 我收藏一下
[解决办法]
学习
[解决办法]
顶起来
[解决办法]
学习中

热点排行