c# - 在 C# 中地理定位 IP 地址

标签 c# .net windows-8 ip-geolocation

我正在用 C# 开发 Windows 8 应用程序 并希望获得 IP 地址的地理坐标 或者 想要一个可以准确或接近地理定位 Windows 8 应用程序中的 IP 地址的 API! 预先感谢您的帮助!

最佳答案

只需使用此处的 Web 服务,每小时 10000 个请求是免费的

http://freegeoip.net/static/index.html

REST 调用 http://freegeoip.net/xml/[your ip]

编辑

从 url 下载的简单代码

using (var objClient = new System.Net.WebClient())
{
    var strFile = objClient.DownloadString("http://freegeoip.net/xml/192.168.0.1");
}

关于c# - 在 C# 中地理定位 IP 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14959305/

相关文章:

c# - 在 JavaScript 中访问 C# 变量

c# - 无法加载文件或程序集 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' 或其依赖项之一

c# - 在 C# 中调用 Cygwin GCC DLL 在 malloc 上挂起

c# - 如何在 C# 中每 2 小时调用一次方法

.net - 在同一解决方案/项目中使用 Visual Studio 针对 32 位和 64 位

c# - Func<T> 的性能和继承

c# - 如何检测 Sharepoint 文件何时位于子文件夹中

c# - 为什么这个派生类的行为不同于它的基类

c# - Windows 8 中的 bank-switch USB 设备

c# - HttpClient GetAsync 在 Windows 8 的后台任务中失败