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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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?


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/ 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

Do I have to buy it?

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


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Map.aspx.cs" Inherits="Map" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
	<title>Engineer Location</title>
    <script src=";v=2&amp;key=ABQIAAAAPoDXLJ3j-lJBB4t9TrSIARSARZ2evJNEpLfUwKvQ5Np0EVA1cBQY8j2bf-nRNFDQ3kpHeHPiyQ1e-A"
	<script type="text/javascript">
    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 = "";
    icon.shadow = "";
    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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.