Getting Started with the Bing Maps AJAX Control
You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.
The Bing Maps™ map control is a JavaScript control that contains the objects, methods, and events that allow you to display maps powered by Bing Maps on your Web site. The sections in this topic describe the steps you need to take to start using the Bing Maps AJAX Control 6.3.
Get Familiar with the Bing Maps AJAX Control
The Developing with the Bing Maps AJAX Control section of this SDK contains topics that describe how to use the features provided by the AJAX map control. For information about displaying a map on your Web page, see the Displaying a Map Using JavaScript topic or the Displaying an Embedded Map topic.
Register Your Map Control Application
Create a Bing Maps Account and Get a Key
Once you have created your Bing Maps AJAX Control 6.3 application, you need to register this application using the Bing Maps Account Center. The Bing Maps Account Center allows you to create a developer account and get a Bing Maps Key for use in your application. These steps are described in the Getting a Bing Maps Key topic.
Use the Bing Maps Key in Your Application
After you have created a Bing Maps Account, available Bing Maps Keys appear in the Bing Maps Account Center. 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"
"https://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="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?
v=6.3"></script>
<script type="text/javascript">
var map = null;
function GetMap()
{
map = new VEMap('myMap');
map.SetCredentials("Your Bing Maps Key");
map.LoadMap();
}
</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 6.3 is loaded with a valid Bing Maps Key, Bing Maps counts sessions. A session begins with the load of the Bing Maps AJAX Control 6.3 into a user’s browser and includes all Bing Maps AJAX Control 6.3 interactions until the browser is closed or the user moves to a different page. Information about Bing Maps usage reports is in Viewing Bing Maps Usage Reports.
Note
If you are using tokens retrieved from the Bing Maps Token Service in your Bing Maps AJAX Control 6.3 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