Register Your Bing Maps AJAX Control Application
Register Your Bing Maps AJAX Control Application

Use the Bing Maps Account Center to register your Bing Maps AJAX Control application.

Create a Bing Maps Developer Account

To get a Bing Maps Key to use in your application, you first need to create a Bing Maps Developer Account.

  1. Go to the Bing Maps Account Center at https://www.bingmapsportal.com and click the Create an account link.

  2. Sign in using your Windows Live ID. If you do not have a Windows Live ID, you can get one at https://www.bingmapsportal.com/SignIn/Logon.

  3. Once you have signed in using a valid Windows Live ID, you are asked to provide the following items:

    • Account name Required. A friendly name that you and Microsoft can use to identify your account. You can also reference the unique ID that is assigned when your account is created.

    • Contact name The name of the developer account owner. Alternatively, this is the name of someone that can be contacted when questions about this developer account arise.

    • Company name The name of the company using this developer account.

    • Email address Required. An email address which should be used to communicate with the developer account owner. This address can be the Windows Live ID used to login to the Bing Maps Account Center.

    • Phone number A phone number that can be used in communications about this developer account.

    • API terms of use Required. Review the terms of use and check the box to accept them.

Ee692181.Tip(en-us,MSDN.10).gifTip:
You can update your Bing Maps Developer Account information any time by clicking the Update or view account details link.

Get a Bing Maps Key

Once you have created a Bing Maps Developer Account, you can create up to five Bing Maps Keys for use in your Bing Maps applications.

  1. On the Bing Maps Account Center left-hand navigation pane, click Create or view keys.

  2. If you have never created any keys, the list of available keys will be empty. To create a new key, enter the name of your application and the URL which corresponds to the website where the key will be used. Then click the Create key button. The page is updated and the new key is added to the list of available keys.

Ee692181.Important(en-us,MSDN.10).gifImportant:
You can create up to five Bing Maps Keys.

Use the Bing Maps Key in Your Application

After you have created a Bing Maps Developer Account, available Bing Maps Keys appear in the Bing Maps Account Center. Click the Create or view keys link to view them. Copy the key associated with the Web site URL which corresponds to the application you are building and use this string value in the VEMap.SetCredentials Method as shown in the example below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>SetCredentials</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?
v=6.2"></script>

      <script type="text/javascript">
         var map     = null;
         
         function GetMap()
         {
            map = new VEMap('myMap');

            map.AttachEvent("oncredentialserror", MyHandleCredentialsError);
            map.AttachEvent("oncredentialsvalid", MyHandleCredentialsValid); 

            map.SetCredentials("Bing Maps Key");   

            map.LoadMap();        

         }


         function MyHandleCredentialsError()
         {
            alert("The credentials are invalid.");
         }

         function MyHandleCredentialsValid()
         {
            alert("The credentials are valid.");
          
         }


      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
   </body>
</html>
Session Counting

When the Bing Maps AJAX Control is loaded with a valid Bing Maps Key, Bing Maps counts sessions. A session begins with the load of the Bing Maps AJAX Control into a user’s browser and includes all Bing Maps AJAX Control interactions until the browser is closed or the user moves to a different page.

Ee692181.note(en-us,MSDN.10).gifNote:
If you are using tokens retrieved from the Bing Maps Token Service in your Bing Maps AJAX Control application, transaction definitions can be found in the Viewing Bing Maps Transaction Reports topic.

See Also

Reference

VEMap.SetCredentials Method
VEMap.oncredentialserror Event
VEMap.oncredentialsvalid Event

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View