I have an ASP.NET website written in C#.
On this site I need to automatically show a start page based on the user\'s location.
Can I get name of user\'s city
An Alternative to using an API is to use HTML 5 location Navigator to query the browser about the User location. I was looking for a similar approach as in the subject question but I found that HTML 5 Navigator works better and cheaper for my situation. Please consider that your scinario might be different. To get the User position using Html5 is very easy:
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
else
{
console.log("Geolocation is not supported by this browser.");
}
}
function showPosition(position)
{
console.log("Latitude: " + position.coords.latitude +
"
Longitude: " + position.coords.longitude);
}
Try it yourself on W3Schools Geolocation Tutorial