locked
Google map api issue in asp.net RRS feed

  • Question

  • User892410294 posted

    hi,

    I have developed one  application using asp.net. I got the one api key which works locally but when i host on the server, it is not working. it shows alart message that google needs another api key.

    so, How to get the correct google map api for asp.net website which works on server as well as in local system.

    Thursday, August 22, 2013 11:37 AM

All replies

  • User1508394307 posted

    I think, key is not required anymore. See this https://developers.google.com/maps/documentation/javascript/v2/

    Thursday, August 22, 2013 11:42 AM
  • User892410294 posted

    in my application api key is required. pls give some other suggesion

    Thursday, August 22, 2013 12:08 PM
  • User1508394307 posted

    If you need a key - you have to get it from google https://code.google.com/apis/console/ 

    Perhaps your first key was for http://localhost and now you need it for your internet domain name.

    For up to 25,000 map loads per day google maps does not require a key. For more info, check https://developers.google.com/maps/faq

    Thursday, August 22, 2013 1:16 PM
  • User892410294 posted

    thank you Mr. Smirnov for reply.

    This is my code. which works locally . not works when host on server.

    protected void bind_google_map(string address, string zip)
    {
    string strFullAddress = string.Empty;
    string sMapKey = System.Web.Configuration.WebConfigurationManager.AppSettings["googlemaps.subgurim.net"].ToString();
    Subgurim.Controles.GeoCode geocode;
    strFullAddress = address;
    gmap1.Key = sMapKey;
    geocode = gmap1.getGeoCodeRequest(strFullAddress, sMapKey);
    //geocode = gmap1.geoCodeRequest(gmap1.geoCodeRequest(strFullAddress, sMapKey));
    GLatLng glating = new GLatLng(geocode.Placemark.coordinates.lat, geocode.Placemark.coordinates.lng);
    ViewState["w_user_lati_ses"] = (float)geocode.Placemark.coordinates.lat;
    ViewState["w_user_longti_ses"] = (float)geocode.Placemark.coordinates.lng;

    gmap1.setCenter(glating, 15, Subgurim.Controles.GMapType.GTypes.Normal);
    GMarker oMarker = new GMarker(glating);
    gmap1.addGMarker(oMarker);
    GInfoWindow window = new GInfoWindow(oMarker, "<b>" + lbladdship1.Text.Trim() + ",<br/>" + lbladdship2.Text.Trim() + ",<br/>" + lbladdshipcity.Text.Trim() + ",<br>" + lblshipstate.Text.Trim() + "-" + lbladdshippin.Text.Trim() + "</b>", true);

    gmap1.addInfoWindow(window);
    gmap1.Visible = true;
    gmap1.enableHookMouseWheelToZoom = false;
    gmap1.enablePostBackPersistence = true;

    gmap1.enableRotation = true;
    gmap1.mapType = GMapType.GTypes.Hybrid;
    gmap1.addMapType(GMapType.GTypes.Normal);
    // gmap1.addControl(new GControl(GControl.preBuilt.LargeMapControl));
    gmap1.addControl(new GControl(GControl.preBuilt.MapTypeControl));
    gmap1.addControl(new GControl(GControl.preBuilt.LargeMapControl3D));


    gmap1.enableRotation = true;


    }

    webconfig:

    <add key="googlemaps.subgurim.net" value="<api key>" />

    it throws alart message follows:

    Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: https://developers.google.com/maps/documentation/javascript/tutorial#Obtaining_Key.

    pls help me out. 

    Thursday, August 22, 2013 1:32 PM
  • User1508394307 posted

    Well, it seems you are using a third party library which calls google maps.

    Check its documentation http://en.googlemaps.subgurim.net/ejemplos/ejemplo_1000_Clave-de-Google-o-Key-.aspx and if it does not help, contact its support http://en.googlemaps.subgurim.net/foro/ 

    It's up to you but I don't see any reason to use it, because you can do most of the things with pure google maps.  

    Thursday, August 22, 2013 1:44 PM