如何获得服务器的IP地址? [英] How to get the server IP Address?

查看:142
本文介绍了如何获得服务器的IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个1号线的方法来获取服务器的IP地址?

感谢


解决方案

  Request.ServerVariables [LOCAL_ADDR];

文档


  

返回在其请求进来的服务器地址,这是计算机上的重要哪里有可以绑定到计算机上多个IP地址,并要找出解决使用的请求。


这是从它们涉及到客户端计算机的远程地址不同。

Is there a 1 line method to get the IP Address of the server?

Thanks

解决方案

Request.ServerVariables["LOCAL_ADDR"];

From the docs:

Returns the server address on which the request came in. This is important on computers where there can be multiple IP addresses bound to the computer, and you want to find out which address the request used.

This is distinct from the Remote addresses which relate to the client machine.

这篇关于如何获得服务器的IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆