Get user current location using C# and VB.Net in ASP.Net

Last Reply 6 months ago By dharmendr

Posted 6 months ago


can we convert this code to c# instead of javascript i want to apply the current location on listview item databound so i want it c# code

<script type="text/javascript" src=""></script>
<script type="text/javascript">
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(function (p) {
            var LatLng = new google.maps.LatLng(p.coords.latitude, p.coords.longitude);
            var geocoder = geocoder = new google.maps.Geocoder();
            geocoder.geocode({ 'latLng': LatLng }, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    if (results[1]) {
                        document.getElementById("lblAddress").innerHTML = "Your location: <b>" + results[1].formatted_address + "</b>";
    } else {
        alert('Geo Location feature is not supported in this browser.');
<span id="lblAddress"></span>