Tag Archives: WebService

MapPoint WebService authentification with Mono

Recently, I was faced with a little problem. I built a .net program which calls a MapPoint WebService. It worked fine on Windows but failed on Mono/Linux with a “401 Unauthorized” error.

As it really made no sense, I decided to listen to the network communication. It did it with wireshark on my computer and tcpdump on the Mono/Linux host. And by looking at the header of the HTTP request, I noticed they were some slight differences.

I solved the problem by specifying some credentials and by using a particular host name for these credentials, here is the code :

var cred = new System.Net.NetworkCredential("---user---", "---password---");
_credCache = new CredentialCache();
_credCache.Add( new Uri( "http://findv3.staging.mappoint.net" ), "Digest", cred );
_finder = new FindServiceSoap();
_finder.Credentials = _credCache;
_finder.PreAuthenticate = true;