c# - 获取公共(public) Internet IP 地址/geo loc 的智能方法

标签 c# .net geolocation ip-address

我在本地网络上有一台计算机,在 NAT 路由器后面。我有一些 192.168.0.x 地址,但我真的很想知道我的公共(public) IP 地址,而不是

中提到的内容

How to get the IP address of the server on which my C# application is running on?

How to get the IP address of a machine in C#

我需要 C# 代码。

这可能吗?如果是,怎么办?

最佳答案

我更喜欢 http://icanhazip.com .它返回一个简单的文本字符串。无需 HTML 解析。

string myIp = new WebClient().DownloadString(@"http://icanhazip.com").Trim();

关于c# - 获取公共(public) Internet IP 地址/geo loc 的智能方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4879837/

相关文章:

javascript - C#.NET : Server is not able to validate Angular Client [IdentityServer]

node.js - Mongodb GeoSpatial Query with NodeJs (Haversine formula)

c# - 强制加载整页

c# - Visual Studio 2012 找不到模板

asp.net - AiHandleErrorAttribute 与。 Application Insights 提供的内置自动添加操作筛选器

.net - 生成 .tail IL 指令的简单 F# 代码是什么?

html - 不在 polymer 上显示位置(使用谷歌地图)

javascript - 面向学生的基于位置的网络网站

c# - 什么时候使用哪种设计模式?

c# - WPF 文本字符 'g' 、 'q' 和其他字符在 TabItem 中被截断