asp.net多域名查询源码
用.net开发的网页,有一个模块是多域名查询功能,谁有源码,贡献一下,他的格式是一个文本框,一个按钮,再加上多个复选框来实现,...
用.net开发的网页,有一个模块是多域名查询功能,谁有源码,贡献一下,他的格式是一个文本框,一个按钮,再加上多个复选框来实现,
展开
1个回答
展开全部
域名Whois信息查询(ASP.NET+C#)
去年写的了,是从点缀的博客学来的
看演示请点这里:http://www.aspxboy.com/whois.aspx
代码如下:
<% @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://www.aspxboy.com/whois.aspx
代码如下:
<% @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>
北京磐安云创科技有限公司_
2023-01-31 广告
2023-01-31 广告
价格只是购买产品或服务过程中的一项指标,如果单纯只比较价格,其实考虑并不是那么周到。价格、质量、服务、口碑、是否合适自己的情况等都需要一起考虑。以上回答如果还觉得不够详细,可以来咨询下北京磐安公司。北京磐安公司是一家专业从事高新软件的技术公...
点击进入详情页
本回答由北京磐安云创科技有限公司_提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询