zl程序教程

您现在的位置是:首页 >  后端

当前栏目

asp.net通过指定IP地址得到当前的网络上的主机的域名

NetASP域名网络 通过 指定 当前 IP地址
2023-06-13 09:14:08 时间
<%@ImportNameSpace="System.Net"%>
<scriptlanguage="C#"runat=server>
protectedvoiddoClick(ObjectSrc,EventArgsE){
IPHostEntryhostInfo=DNS.GetHostByAddr(txtIP.Text);
showmsg.Text=hostInfo.Hostname;
}
</script>
<asp:Labelrunat=serverid=showmsg/>
<formid=testFormrunat=server>
要查找的IP地址:<asp:TextBoxrunat=serverid=txtIP/><asp:Buttonrunat=serverid=doText="查找"onClick=doClick/>
</form>