Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  


Call Bing REST Mapping Services from .NET
Bing has a REST service to geocode an address which can be called from .NET with a valid key.

They offer a dataContract API which you can easily use to load the results. However, they state that they can update the contract at any time, which means you would have to update your website whenever it changes.

If you are only using basic properties that are unlikely to change, you can get around this by getting the REST output as XML and searching for the data you need.

Here is how to call the service and retrieve the result XML. 'url' is the query that you sent to bing. An example URL is ""

// prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

// execute the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

// throw if not status 200
if (response.StatusCode != HttpStatusCode.OK)
throw new Exception(response.StatusCode.ToString() + " received from " + url);

XmlDocument xdoc = new XmlDocument();

// we will read data via the response stream
using (Stream resStream = response.GetResponseStream())

return xdoc;

Created By: amos 4/1/2013 5:06:05 PM
Updated: 4/1/2013 5:08:49 PM