当前位置: 代码迷 >> ASP.NET >> 在asp中知道ip如何得到该机的名字
  详细解决方案

在asp中知道ip如何得到该机的名字

热度:5834   发布时间:2013-02-26 00:00:00.0
在asp中知道ip怎么得到该机的名字
首次接触asp请指点,希望给你例子,还有就是给个C#能输出的例子,谢谢。

------解决方案--------------------------------------------------------
public static string currentInfo = "IP地址:" + System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] + " 计算机名:" + System.Environment.MachineName.ToString();
------解决方案--------------------------------------------------------
IPHostEntry myHost = Dns.GetHostByAddress(IPAddress.Parse("特定的IP,也就是你想获取机器名的ip"));
string HostName = myHost.HostName.ToString();
 
  相关解决方案