如何在C#应用程序中使用HTML5地理位置 [英] How can I use HTML5 geolocation in C# application

查看:101
本文介绍了如何在C#应用程序中使用HTML5地理位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一种防盗软件,以获取计算机的确切位置.内置gps的笔记本在我的国家非常罕见,因此我必须在应用程序中使用 HTML5地理位置.

I'm developing an anti-theft software to get computers exact location. Notebooks with built-in gps are very rare in my country so I have to use HTML5 Geolocation in my application.

对于Internet Explorer 9+,有一个注册表项,您可以添加URL以允许不需要用户验证的URL.如果在 HKCU \ Software \ Microsoft \ Internet \ Geolocation \ HostConsent 下添加一个名为domain.com的 REG_DWORD 值,路径浏览器将自动允许地理定位请求.但是,我无法隐藏运行Internet Explorer,因为小偷不应该意识到并看到发生了什么事,因此这对我不起作用.

For Internet Explorer 9+, there is a registry key that you can add urls to allow a url without needing user verification. If you add an REG_DWORDvalue named domain.com under HKCU\Software\Microsoft\Internet Explorer\Geolocation\HostConsent path browser will allow geolocation request automatically. However I can't run Internet Explorer hidden so thats not working for me since thief shouldn't realize and see what's going on.

  • 我需要以某种方式运行隐藏的Internet Explorer
  • ...或者我需要将webkit或其他内容嵌入到我的应用程序中,但是我不知道如何使用它或如何以编程方式允许此请求.

我更喜欢第二种方式,因为Internet Explorer现在已被Microsoft终止,并且我认为下一版本将具有不同的结构.

I prefer second way because Internet Explorer is now terminated by Microsoft and I think next version will have different structure.

如何在我的应用程序中嵌入和使用Webkit或GeckoFX?如何在此应用程序中以编程方式允许地理位置请求?

How can I embed and use Webkit or GeckoFX to my application? How can I allow a geolocation request programmatically in this application?

推荐答案

依靠隐藏的浏览器是一种冒险的解决方案,将来不可避免地会中断.

Relying on a hidden browser is a risky solution, and it will inevitably break at some point in the future.

相反,您想将地理位置功能内置到您自己的应用程序中.位置信息的两个主要来源是您的IP地址(然后您将其输入

Instead you want to build geolocation functionality into your own application. The two major sources of location info are your IP address (which you then feed into any of the GeoIP providers) and cellular/Wi-Fi stations visible (which you feed into Google geolocation API).

这篇关于如何在C#应用程序中使用HTML5地理位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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