[英]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.