How can I find a custom GEO location using ASP.NET?

How can I get the location of a GEO user in my ASP.NET application? I noticed that in browsers such as Firefox and Google Chrome, I (as a user) ask whether or not to allow access to the site for my location.

How can I achieve a similar thing?

+3
source share
2 answers

The prompt you see is displayed when the site uses the geolocation API . All this is JavaScript, so you do not need any server support to use it. If you need server-side values, you can send them back using XMLHttpRequest or a simple form message.

There's a demo here with readable source code.

+4
source

Use the usual HTML5 Geolocation tools to get the location, and then use AJAX to send the location back to your ASP.NET server side code and update any client items.

+4
source

Source: https://habr.com/ru/post/1765657/


All Articles