有没有可靠的方法来确定用户的互联网连接位置?

时间:2021-03-20 09:10:36

I have created a Business Management System which is to be used by retailers with or without multiple sites.

我创建了一个商业管理系统,供有或没有多个站点的零售商使用。

It is important that a logged in user identifies his/her location, or site, so that the system can perform site related tasks automatically.

登录用户识别他/她的位置或站点非常重要,这样系统就可以自动执行与站点相关的任务。

I currently have a database of locations which includes an IP Prefix field, when the user goes to the log in page it looks for the first 5 digits of the current IP address, then:

我目前有一个包含IP Prefix字段的位置数据库,当用户进入登录页面时,它会查找当前IP地址的前5位数字,然后:

  • If start of current IP matches a stored record it assumes user is at that site.
  • 如果当前IP的开始与存储的记录匹配,则假定用户在该站点。
  • If no IP matches then it asks the user which site they're in and asks them to update the IP.
  • 如果没有IP匹配则它会询问用户他们所在的站点并要求他们更新IP。

This basic, and manual check works when the sites are a fair distance away or are on different ISPs for certain, the update is usually only required after a router restart and I've been using the system myself for about 4 years with no issues... BUT... I am not confident with it, so my question is; is there a better solution?

当站点距离相当远或者在不同的ISP上时,这种基本和手动检查有效,通常只有在路由器重启后才需要更新,并且我自己使用系统大约4年没有问题。但是......我对它没有信心,所以我的问题是;有更好的解决方案吗?

I realise the IP address is probably not the way as the best that gives me is the location of their ISP, but that's not what I need.

我意识到IP地址可能不是最好的方式,它给我的是他们的ISP的位置,但这不是我需要的。

In case it matters I am using ASP.NET coding in VB

如果它很重要我在VB中使用ASP.NET编码

Also, should mention, I'm looking for desktop based application, not mobile.

另外,应该提一下,我正在寻找基于桌面的应用程序,而不是移动应用程序。

3 个解决方案

#1


1  

I think you are going to have to rely on user input for this one. It's impossible (or at least, very very difficult) to know whether a user is using a proxy or not, and if they are you have no way of knowing where they really are. This is right and proper; would you trust every website you access with that kind of information? I sure as hell wouldn't.

我认为你将不得不依赖这个用户输入。知道用户是否使用代理是不可能的(或者至少非常非常困难),如果他们是你无法知道他们到底在哪里。这是正确的;你会信任你使用这种信息访问的每个网站吗?我肯定不会。

#2


0  

You can't use the IP address to give you 100% reliable location data if your clients connect over the internet (they could be going through a proxy or as you said you might just get the ISP's IP address)

如果您的客户端通过互联网连接,则无法使用IP地址为您提供100%可靠的位置数据(它们可能通过代理或者您说可能只是获取ISP的IP地址)

Your best bet is to use javascript to get the users geolocation: W3 Schools Example

您最好的选择是使用javascript来获取用户地理位置:W3 Schools示例

More complex example on html5demos

关于html5demos的更复杂的例子

#3


0  

No, of course it is not possible to reliably locate an user by IP Adress. That adress can be faked, so the base of your info is not reliable.

不,当然不可能通过IP地址可靠地定位用户。该地址可能是伪造的,因此您的信息基础不可靠。

#1


1  

I think you are going to have to rely on user input for this one. It's impossible (or at least, very very difficult) to know whether a user is using a proxy or not, and if they are you have no way of knowing where they really are. This is right and proper; would you trust every website you access with that kind of information? I sure as hell wouldn't.

我认为你将不得不依赖这个用户输入。知道用户是否使用代理是不可能的(或者至少非常非常困难),如果他们是你无法知道他们到底在哪里。这是正确的;你会信任你使用这种信息访问的每个网站吗?我肯定不会。

#2


0  

You can't use the IP address to give you 100% reliable location data if your clients connect over the internet (they could be going through a proxy or as you said you might just get the ISP's IP address)

如果您的客户端通过互联网连接,则无法使用IP地址为您提供100%可靠的位置数据(它们可能通过代理或者您说可能只是获取ISP的IP地址)

Your best bet is to use javascript to get the users geolocation: W3 Schools Example

您最好的选择是使用javascript来获取用户地理位置:W3 Schools示例

More complex example on html5demos

关于html5demos的更复杂的例子

#3


0  

No, of course it is not possible to reliably locate an user by IP Adress. That adress can be faked, so the base of your info is not reliable.

不,当然不可能通过IP地址可靠地定位用户。该地址可能是伪造的,因此您的信息基础不可靠。