New to Telerik UI for WinFormsStart a free 30-day trial

How to Deal with Empty RadMap using BingRestMapProvider

Updated over 6 months ago

Environment

Product VersionProductAuthor
2022.3.1109RadMap for WinFormsDesislava Yordanova

Description

When using RadMap with the BingRestMapProvider, the map may remain empty. This article shows how to handle this unexpected behavior and load the map tiles.

Solution

Please note that Bing Maps will be deprecated effective June 30, 2025. As an alternative, users can refer to the SDK example available in our GitHub repository, which demonstrates how to create a custom provider using the Azure Maps API. A valid Azure Maps subscription key is required to use this functionality.

BingRestMapProvider internally loads tile data from the Bing Maps REST service which requires TLS 1.2 coming automatically with .NET Framework 4.7. It is necessary to ensure the version explicitly by setting the System.Net.ServicePointManager.SecurityProtocol property to SecurityProtocolType.Tls12. More information is available here: Transport Layer Security (TLS) best practices with the .NET Framework.

C#

 // How to specify Tls 1.2 for .NET Framework 4.0
 //System.Net.ServicePointManager.SecurityProtocol =(System.Net.SecurityProtocolType)3072;

 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

 string cacheFolder = @"..\..\cache";

 BingRestMapProvider bingProvider = new Telerik.WinControls.UI.BingRestMapProvider();
 bingProvider.UseSession = true;
 bingProvider.BingKey = bingKey;

 LocalFileCacheProvider cache = new LocalFileCacheProvider(cacheFolder);
 bingProvider.CacheProvider = cache;

 this.radMap1.Providers.Add(bingProvider);     

See Also