Zha*_*uid 57
Request.ServerVariables["LOCAL_ADDR"];
Run Code Online (Sandbox Code Playgroud)
来自文档:
返回请求所在的服务器地址.这对于可能有多个绑定到计算机的IP地址的计算机很重要,并且您想要找出请求使用的地址.
这与客户端计算机相关的远程地址不同.
从搜索网上我发现以下代码:(我找不到单行方法)
string myHost = System.Net.Dns.GetHostName();
// Show the hostname
MessageBox.Show(myHost);
// Get the IP from the host name
string myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[index].ToString();
// Show the IP
MessageBox.Show(myIP);
Run Code Online (Sandbox Code Playgroud)
- >其中index是你的ip地址主机的索引(即网络连接).
代码来自:http://www.geekpedia.com/tutorial149_Get-the-IP-address-in-a-Windows-application.html
归档时间: |
|
查看次数: |
52865 次 |
最近记录: |