How can I find a user's GEO Location using ASP.NET?

前端 未结 2 1658
暖寄归人
暖寄归人 2021-01-06 16:05

How can I get hold of a user\'s GEO location within my ASP.NET application? I\'ve noticed on browsers like Firefox and Google Chrome, I (as the user) am prompted as to wheth

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-06 16:39

    The prompt you're seeing is shown when a site uses the Geolocation API. It's all JavaScript, so you don't need any kind of server support to use it. If you want the values on the server side, you can send them back using XMLHttpRequest or a simple form post.

    Here's a demo with easy to read source code as well.

提交回复
热议问题