This question already has answers here:
Closed 2 years ago.
I am making a web site targeted at mobile phones and would like to get the user's current GPS latitude/longitude when they visit my default page so I can show them results in their area. Is this possible using ASP.NET?
See Also
Get position data from mobile browser
There are services that will give you a location based on IP address. It won't be as precise as the GPS data but without having an application installed on the phone it may be as close as you are going to get.
Yes, you can do it with JavaScript and submit results back to server:
function onPositionUpdate(position)
{
var lat = position.coords.latitude;
var lng = position.coords.longitude;
alert("Current position: " + lat + " " + lng);
}
if(navigator.geolocation)
navigator.geolocation.getCurrentPosition(onPositionUpdate);
else
alert("navigator.geolocation is not available");
Currently, GeoLocation API is highly available in modern smartphones.
See my answer to related question How to Get GPS location from the web browser. The solution is pure-javascript so it is server-technology-independent.
You'd have to get security permission to access the appropriate GPS API. As long as you know the API, you'll be able to obtain the appropriate data, but it'll depend on the OS. I know it is accessible via Python as PyS60 for Nokia phones.
You're not going to have much luck at the moment, but this is something that should be possible within a few years.
The W3C have published a Geolocation API Draft, and this has been implemented into a jailbreak iPhone app called Locatable, but support is going to be so few and far between it's not worth the implementation time!