我们网站想加一个域名查询系统。但没找到合适的源码。 大家帮帮忙。谢谢只要能查询就可以了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 网上找的个,希望对你有用。我自己也没仔细看!<% @Page Language="C#" %><% @Import Namespace="System.Net.Sockets" %><% @Import Namespace="System.Text" %><% @Import Namespace="System.IO" %><html><head><title>.Com/.Net/.Org/.Cn 域名Whois信息查询</title><meta name="keywords" content=".Com,.Net,.Org,.Cn 域名Whois信息查询"><meta name="generator" content=".Com/.Net/.Org,.Cn 域名Whois信息查询"><meta name="description" content=".Com/.Net/.Org,.Cn 域名Whois信息查询"><style><!--body,input{ font-family: Tahoma, Verdana; color: #004080; font-size: 12px }a:link,a:visited{ text-decoration: none; color: #004080 }--></style></head><body><form id="fmQuery" runat="server"> 要查询的域名域名: www.<asp:TextBox id="txtDomain" width="100" value="ASPXBOY.COM" runat="server" /> <asp:Button id="btnQuery" OnClick="btn_click" text="查询!" runat="server" />(只能查询.Com/.Net/.Org/.Cn 域名Whois的信息) <a href ="WhoisCode.htm" title="View the source code here!">源代码在这里</a><BR><HR width="550" height="1" align="left"><BR><asp:label id="lblResult" runat="server" /></form></body></html><script language="C#" runat="server">void btn_click(Object sender, EventArgs e){String strServer;String strDomain = txtDomain.Text; String strServerCom = "whois.networksolutions.com"; String strServerCN = "whois.cnnic.net.cn";String strResponse;string[] arrDomain = strDomain.Split('.');if (arrDomain[1].ToUpper()=="CN"){ strServer=strServerCN;}else{ strServer=strServerCom;}bool blSuccess = IsWhosisSuccess(strDomain, strServer, out strResponse);if (blSuccess){lblResult.Text = strResponse;}else{lblResult.Text = "查找失败....";}}bool IsWhosisSuccess(String strDomain, String strServer, out String strResponse){ strResponse = "none"; bool blSuccess = false; TcpClient tcpc = new TcpClient(); try { tcpc.Connect(strServer, 43); } catch(SocketException ex) { strResponse = "连接不到该 Whois server,请稍后再试。"; return false; } 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(); string strLine = null; while (null != (strLine = sr.ReadLine())) { strBuilder.Append(strLine+"<br>"); } tcpc.Close(); blSuccess = true; string my="Go to Huobazi's WebSite:<a href=\"http://www.aspxboy.com\" title=\".Net男孩社区\">www.AspxBoy.Com</a><br>"; strResponse = strBuilder.ToString()+my; } catch(Exception e) { strResponse = e.ToString(); } return blSuccess;} </script> http://topic.csdn.net/u/20080514/11/b7e937a2-17b4-444c-96e2-074aaba8ef7b.html 求助!word在线编辑器 gridview合并列 VS05 在类库中引用web.config为什么说我有错 关于Asp.net 用oracleclient连Oracle乱码的问题 关于这个VB数据库连接类的调用的问题 一个很简单的问题 最后10分送上了 .NET 表格对角线怎么实现?在线等! ArrayList的问题 怎样实现根据登陆用户名不同,页面上显示的东西有不同呢? sql语句 这个是啥子意思呢 用VS2008新建页面时,为什么form里面要自动生成一个div?有什么好处?
<% @Page Language="C#" %>
<% @Import Namespace="System.Net.Sockets" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.IO" %>
<html>
<head>
<title>.Com/.Net/.Org/.Cn 域名Whois信息查询</title>
<meta name="keywords" content=".Com,.Net,.Org,.Cn 域名Whois信息查询">
<meta name="generator" content=".Com/.Net/.Org,.Cn 域名Whois信息查询">
<meta name="description" content=".Com/.Net/.Org,.Cn 域名Whois信息查询">
<style>
<!--
body,input{
font-family: Tahoma, Verdana; color: #004080; font-size: 12px
}
a:link,a:visited{
text-decoration: none; color: #004080
}
-->
</style>
</head>
<body>
<form id="fmQuery" runat="server">
要查询的域名域名:
www.<asp:TextBox id="txtDomain" width="100" value="ASPXBOY.COM" runat="server" />
<asp:Button id="btnQuery" OnClick="btn_click"
text="查询!" runat="server" />(只能查询.Com/.Net/.Org/.Cn 域名Whois的信息) <a href ="WhoisCode.htm" title="View the source code here!">源代码在这里</a>
<BR><HR width="550" height="1" align="left"><BR>
<asp:label id="lblResult" runat="server" />
</form>
</body>
</html>
<script language="C#" runat="server">
void btn_click(Object sender, EventArgs e)
{
String strServer;
String strDomain = txtDomain.Text;
String strServerCom = "whois.networksolutions.com";
String strServerCN = "whois.cnnic.net.cn";
String strResponse;
string[] arrDomain = strDomain.Split('.');
if (arrDomain[1].ToUpper()=="CN")
{
strServer=strServerCN;
}
else
{
strServer=strServerCom;
}bool blSuccess = IsWhosisSuccess(strDomain, strServer, out strResponse);
if (blSuccess)
{
lblResult.Text = strResponse;
}
else
{
lblResult.Text = "查找失败....";
}
}
bool IsWhosisSuccess(String strDomain, String strServer,
out String strResponse)
{
strResponse = "none";
bool blSuccess = false;
TcpClient tcpc = new TcpClient();
try
{
tcpc.Connect(strServer, 43);
}
catch(SocketException ex)
{
strResponse = "连接不到该 Whois server,请稍后再试。";
return false;
} 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();
string strLine = null; while (null != (strLine = sr.ReadLine()))
{
strBuilder.Append(strLine+"<br>");
}
tcpc.Close();
blSuccess = true;
string my="Go to Huobazi's WebSite:<a href=\"http://www.aspxboy.com\" title=\".Net男孩社区\">www.AspxBoy.Com</a><br>";
strResponse = strBuilder.ToString()+my; }
catch(Exception e)
{
strResponse = e.ToString();
}
return blSuccess;
}
</script>