asp.net 通过指定IP地址得到当前的网络上的主机的域名
时间:2021-07-01 10:21:17
帮助过:10人阅读
<%@ 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>