Google+ Followers


Get Updates Via Email

Enter your email address:

Delivered by FeedBurner

Thursday, 4 April 2013

Show your Current Location in Google Maps using ASP.NET C# website and Google Maps API


  • Add this script tag inside <Head> section "
  • <script type="text/javascript"
  • src="">
  • </script>"
  • Inside this Script add your own Key value  [
  • key=AIzaSyByJmQq7PkPaznZUFsH7AesFNUz82U8iOc]  from Google Code
  • 1. Getting User Location function in Javascript coding
       function success(position) {
        var latitude = position.coords.latitude;
        var longitude = position.coords.longitude;
        var city = position.coords.locality;
        var myLatlng = new google.maps.LatLng(latitude, longitude);
        var myOptions = {
            center: myLatlng,
            zoom: 12,
            mapTypeId: google.maps.MapTypeId.SATELLITE
       2. Setting Marker in Google Maps

      var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        var marker = new google.maps.Marker({
            position: myLatlng,
            title: "lat: " + latitude + " long: " + longitude
        var infowindow = new google.maps.InfoWindow({ content: "<b>User Address</b><br/> Latitude:" + latitude + "<br /> Longitude:" + longitude + "" });, marker);

      3. Geolocation to get Location , and calling the Javascript function

if (navigator.geolocation) {
    } else {
        alert("Geo Location is not supported on your current browser!");

   4. Load Google Maps inside map_canvas Div ID in Body Section of ASPX page

<div id="map_canvas" style="width: 800px; height: 400px">

Default.aspx Page


  1. good information in general and a awesome article too.

  2. Where exactly can I find my own key value from Google Code ?

  3. Except showing on google map how i get address on a textbox by using this api in dot net applicaton

  4. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

  5. After selecting google map location, it will be displayed on store front.OCMOD extension.Gmap Geo Address


Share this to your friends