[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 476
  • Last Modified:

Set up a google map in web config

Hi there,
            I am using a google map for my ASP 2.0 application. I am able to see it fine in my machine but when I try in someody's else, it says to register the google API key. I have the key already but I don't think i have it in the right place. How should I set up the API key in the web.config file? Right now, I have it in the codebehind. Where in the web.config it goes.
0
sovroc81
Asked:
sovroc81
  • 2
1 Solution
 
badbearontourCommented:
are you using the development key or have you bought one for the server?

The dev key allows the google map to run on a single machine only, I had problems when I moved the code to a dev server so that I could try it out accross my network. I had to get another key registered for my server so I could use it with IIS6.0.
Are you running from the other machine or are you browsing to your machine to vie the page?

BB

0
 
sovroc81Author Commented:
I am using the development key I guess. My server name is programmer3 and when I registered for the google API, this is what I used for the url..programmer3/foldername/...

When I run the website from my machine, I see the map just fine. But when I use somebody's else and type in programmer3/....to view the site, then I get this error message.

 The google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at code.google.com/apis/maps

Do I have to buy it?


0
 
badbearontourCommented:
My understanding of the licence for use is that you a free to use the maps on a website.
but to use it on a corporate intranet or as part of a business application etc then yes you have to register a enterprise licence that I beleive has a dollar value attached to it.

Still doesn't explain why you have this error though, I can use any client on the network to access the demo map system that I built and put on my dev server. you menetioned that you have the key in the webconfig, I however have mine in the page code itself I have included the snippet of where it is, I wonder if that makes a difference.

could you post the code you use to push the key into the html file, maybe we could start there

BB



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Map.aspx.cs" Inherits="Map" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Engineer Location</title>
 
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAPoDXLJ3j-lJBB4t9TrSIARSARZ2evJNEpLfUwKvQ5Np0EVA1cBQY8j2bf-nRNFDQ3kpHeHPiyQ1e-A"
		type="text/javascript"></script>
 
	<script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
      //var map = new GMap2(document.getElementById("map"));
      //map.addControl(new GSmallMapControl());
      //map.addControl(new GMapTypeControl());
      //map.setCenter(new GLatLng(37.4419, -122.1419), 13);
          var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(52.3, -1.55), 13);
    // Create our "tiny" marker icon
    var icon = new GIcon();
    icon.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";
    icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
    icon.iconSize = new GSize(12, 20);
    icon.shadowSize = new GSize(22, 20);
    icon.iconAnchor = new GPoint(6, 20);
    icon.infoWindowAnchor = new GPoint(5, 1);// Add 10 markers to the map at random locations
    var bounds = map.getBounds();
    var southWest = bounds.getSouthWest();

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now