简体   繁体   English

在IIS中托管时无法获取用户位置

[英]Unable to get user location when hosting in IIS

I am creating a website in asp.net version 4.0. 我正在使用asp.net 4.0版创建一个网站。 I am able to get the device location using GeoCoordinateWatcher class when i host it using local asp.net development server. 当我使用本地asp.net开发服务器托管它时,我能够使用GeoCoordinateWatcher类获取设备位置。 But wen i host it in IIS, I get GeoCoordinateWatcher.permission as denied and GeoCoordinateWatcher.status as disabled. 但是我在IIS中托管它,我将GeoCoordinateWatcher.permission视为已拒绝,并将GeoCoordinateWatcher.status视为已禁用。 Please help. 请帮忙。

UPDATE UPDATE

int count = 0; 
coodi: gcw.TryStart(false, TimeSpan.FromMilliseconds(1000)); 
GeoCoordinate cood; 
var y = gcw.Status; 
if (y != GeoPositionStatus.Ready && count<6) { 
    count++; goto coodi; 
} 
cood = gcw.Position.Location; 
if (cood.IsUnknown != true) { 
    lat = cood.Latitude; 
    lon = cood.Longitude; 
    count = 0; 
} else { 
    lat = lon = -1; 
}

Could anyone help me to request the user to allow me to use his location as any site requests like, "This site wants to use your location? Allow or deny?". 任何人都可以帮我请求用户允许我使用他的位置作为任何网站请求,例如“此网站想要使用您的位置?允许还是拒绝?”。

The API you're looking for is the HTML5 Geolocation API: http://www.w3schools.com/html/html5_geolocation.asp 您正在寻找的API是HTML5 Geolocation API: http//www.w3schools.com/html/html5_geolocation.asp

You can't use local APIs like System.Device.Location from serverside script to get the remote client's location. 您不能使用来自serverside脚本的本地API(如System.Device.Location)来获取远程客户端的位置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 托管到IIS时无法访问打印机 - Unable to access the printer when hosting to iis 通过带有 Windows 身份验证的 IIS 托管 mvc 应用程序,但我得到 IIS APPPOOL\\ APP 我需要连接的 Windows 用户(与 IIS express 一起使用) - Hosting a mvc app via IIS with windows authentication, but I get IIS APPPOOL\ APP I need the windows user that connects (works with IIS express) 在IIS中托管后无法连接SQL(模拟) - Unable to connect the SQL after hosting in IIS (Impersonation) 在 IIS 服务器上托管网站时无法创建数据库。 在本地它正在工作 - Unable to create database when hosting website on IIS Server. Locally it's working 如何从 IIS 主机获取打印权限? - How to get access for print from IIS hosting? 在IIS中托管OWIN / Katana时如何获得WindowsPrincipal? - How do I get the WindowsPrincipal when hosting OWIN/Katana inside IIS? 在IIS上托管时拆分字符串会引发InvalidOperationException - Splitting a string throws InvalidOperationException when hosting on IIS 在多个绑定上承载IIS站点时,如何获取正确的本地地址URI? - How to get the correct local address URI when hosting IIS site on multiple bindings? 无法将类型为“ System.Web.Hosting.SimpleWorkerRequest”的对象转换为类型为“ System.Web.Hosting.IIS7WorkerRequest”的对象 - Unable to cast object of type 'System.Web.Hosting.SimpleWorkerRequest' to type 'System.Web.Hosting.IIS7WorkerRequest' IIS:无法获得高吞吐量 - IIS: Unable to get high throughput
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM