Error 403 - Forbidden on Loading Open Street Map to Win Form with GMap.Net and C#

Trying to load OSM on windows Form using C# and GMap.Net I am getting this error

Exception:The remote server returned an error: (403) Forbidden

    private void Form1_Load(object sender, EventArgs e)
    {

        gMapControl1.DragButton = MouseButtons.Left;
        gMapControl1.CanDragMap = true;
        gMapControl1.MapProvider = GMapProviders.OpenStreetMap;
        gMapControl1.Position = new GMap.NET.PointLatLng(54.6961334816182, 25.2985095977783);
        gMapControl1.MinZoom = 0;
        gMapControl1.MaxZoom = 24;
        gMapControl1.Zoom = 9;
        gMapControl1.AutoScroll = true;


    }

Can you please let me know why this is happening and how I can fix it?

don't forget to set the instance mode to server/cache and set it to the instance of the open street map provider instead of 'GMapProviders.OpenStreetMap'

GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache; 
gMapControl1.MapProvider = GMap.NET.MapProviders.OpenStreetMapProvider.Instance;

It could also be your web proxy settings, see https://stackoverflow.com/a/19609539/2368681

Error code 403 - OSM Help, in a windows application form. We use the gMap.net library and now all of the sudden we get Error code 403 (forbidden) in our application. gmap.net × 244 c# × 182 wpf × 46 winforms × 45 google-maps × 38.net × 20 vb.net × 13 maps × 10 openstreetmap × 8 visual-studio × 7 google-maps-api-3 × 7 polygon × 7 dictionary × 5 mvvm × 5 routes × 5 marker × 5 multithreading × 4 geolocation × 4 c#-4.0 × 3 gps × 3 tooltip × 3 google-maps-markers × 3 overlay × 3 sqlite

"Hi,

All libraries that send a fake user-agent and other faked headers to make the requests appear as if they are coming from web browsers are being blocked. Fix the headers and set a real User-Agent to identify your app and the requests will work again.

Please review our usage policy: https://operations.osmfoundation.org/policies/tiles/ "

This is verbatim reply from OSM.

https://github.com/judero01col/GMap.NET/pull/45 is being used to track this issue. And hopefully a fix will be merged in a a day or two.

Error 403 with OpenStreetMap · Issue #46 · judero01col/GMap.NET , I get Error 403 (forbidden) when using openstreenmap provider. Think the user agent string is blocked. Can I specify my own unique user agent  Premium Plan customers and customers who have migrated from the Premium Plan to the Google Maps Platform pay-as-you-go pricing model have the option to use an API key or a client ID to authenticate requests.

I changed Map Provider from "OpenStreetMapProvider" to "GoogleMapProvider" and the error disappeared.

GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache; mapView.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;

The GMap.NET Open Source Project on Open Hub : News Page, New Post: Gmap doesnt show Openstreet map in WPF New Post: Can we use our google key to connect to google maps from windows forms using gMap.net? Last few days in my WPF app when load Openstreetmap it doesnt show anything i get: Exception: The remote server returned an error (403) Forbidden. GMap.NET is great and Powerful, Free, cross platform, open source .NET control. Enable use routing, geocoding, directions and maps from Coogle, Yahoo!, Bing

GMap.NET, New Post: Load GMDB cache file in windows form I have my own ecw files and I want to load them on top of gmap original map layer sorry I new in GMap and c#. Last few days in my WPF app when load Openstreetmap it doesnt show anything i get: Exception: The remote server returned an error (403) Forbidden. API v0.6 is the current version of the OSM Editing API originally deployed 17-21 April 2009.. This page and the API has been extended and updated multiple times since April 2009:

GMap.NET, GMap.NET is a powerful, free, cross platform, Open Source .NET control. It enables the use of routing, geocoding, and maps from Google, Yahoo!, OpenStreet in  An archive of the CodePlex open source hosting site

Gmaps wpf, NET Windows Forms & Presentation is an excellent open source, powerful, free 4 Nov 2017 GMap Part 0 (How to get Google Map API Key?) Mapping for Wpf can load any file with the ESRI Shapefile format and its associated database. a "Exception: The remote server returned an error: (403) Forbidden" I believe this  In this article I will show you an approach can be easily employed to write efficient code that can be useful for signal and image processing, neural networks, or game applications.

Comments
  • Can you show us the complete HTTP request and response, e.g. using wireshark? Which OSM tile server are you using? Does your program respect the tile usage policy, for example does it send a valid referrer?
  • To complement scai's comment, usually tile servers (and their stylesheets) don't go above 18-20 zoom level. It should not result in HTTP 403 statuses, but beware of this.
  • @scai, thanks for reply where can I check the Tile server? I mean as I said I am using GMap.Net so how can I check the request or tile usage policy?
  • Sorry, I don't know. I've never used this framework.
  • @Behseini Did you ever solve this? I assume it's some kind of policy issue with OSM (GMap.NET seems to have a lot of those kind of issues).