how to detect incorrect bing application key

3 posts, 0 answers
  1. ewart
    ewart avatar
    221 posts
    Member since:
    Jan 2007

    Posted 21 Jun 2010 Link to this post

    If my bing key the user uses in my map application is incorrect then they just get a gray screen and the map runs without any exceptions.  The InitializeCompleted event fires normally - is there some property I can check to see if map key is correct?    I want to be able to popup a message to advise the user they need to supply a valid map key.

    was thinking about some sort of hack, like seeing if tiles are downloaded or something but not sure how I can achieve this.


  2. Andrey
    Andrey avatar
    1681 posts

    Posted 21 Jun 2010 Link to this post

    Hi Ewart,

    We have WCF-proxy code for the Bing services which is generated automatically by VS. This code executes requests in a separate thread. When WCF service (Bing service in our case) returns ANY error this code throws an exception instead of passing error to our response handler. Since it is executed in the separate thread we can't handle this exception using try-catch.
    It is good known issue with calling WCF services from Silverlight. We are working on this problem, but unfortunately we have no solution yet.
    The problem you have is related to the PITS Issue we already have.
    You can track its implementation by the following PITS Issue:

    As workaround you can check that the Bing Map provider has not been initialized properly within the InitializeCompleted event handler. When the provider source does not returns the Uri for minimal zoom and left-top corner of the map then the provider is not initialized properly.
    Please, see the following sample code:

    private void radMap_InitializeCompleted(object sender, EventArgs e)
        MapProviderBase source = this.radMap.Provider.GetSource(this.radMap.Provider.Mode,
        Uri uri = source.GetTile(9, 0, 0);
        if (uri == null)
            // the provider has not been initialized properly
            // Bing Maps imigary service is unavailable or application id is not valid

    Sincerely yours,
    Andrey Murzov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. ewart
    ewart avatar
    221 posts
    Member since:
    Jan 2007

    Posted 28 Jun 2010 Link to this post

    this works perfectly for me, thanks guys.
Back to Top