asp.net 通过指定IP地址得到当前的网络上的主机的域名
作者:
通过指定的ip地址获取当前网络的主机的域名,大家可以看看
<%@ Import NameSpace="System.Net" %>
<script language="C#" runat=server>
protected void doClick(Object Src, EventArgs E){
IPHostEntry hostInfo = DNS.GetHostByAddr(txtIP.Text);
showmsg.Text=hostInfo.Hostname;
}
</script>
<asp:Label runat=server id=showmsg />
<form id=testForm runat=server>
要查找的IP地址:<asp:TextBox runat=server id=txtIP /><asp:Button runat=server id=do Text="查找" onClick=doClick />
</form>
<script language="C#" runat=server>
protected void doClick(Object Src, EventArgs E){
IPHostEntry hostInfo = DNS.GetHostByAddr(txtIP.Text);
showmsg.Text=hostInfo.Hostname;
}
</script>
<asp:Label runat=server id=showmsg />
<form id=testForm runat=server>
要查找的IP地址:<asp:TextBox runat=server id=txtIP /><asp:Button runat=server id=do Text="查找" onClick=doClick />
</form>