如何使用 C#.Net 检索我的公共 IP 地址?
我想通过以下方式将 IP 地址存储到数据库表中C#.Net 编码。如何使用 C#.Net 获取静态 IP 地址(我们从 www.whatismyip.com 获取)?有哪些方法可以找回呢?
Possible Duplicates:
How to get my own IP address in C#?
How to Get IP Address?
I want to store the IP Address to the DataBase table through C#.Net coding. How to get the static IP Address(What we get from www.whatismyip.com) using C#.Net? What are the ways to retrieve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以通过
HttpContext.Current.Request.UserHostName
获取You can get it through
HttpContext.Current.Request.UserHostName
你可以这样得到它:
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
You can get it like this:
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];