Page 1 of 1

.NET Map control with http authentification

Posted: Wed Dec 17, 2014 8:51 am
by RolandK
Hi guys!

Currently, we are using the AjaxMaps-Control in our desktop application. Now, we wanted to try the PTV xServers .NET controls, as we will change eventually.

The connection to my local xMap instance works without problems, the control displays the map. But on our productive server, we use http authentification over the file "users.properties" in the folder xmap\confs and here I am unable to get the map-control work. It doesn't show the map.

What do i have to do, so that the PTV xServer .NET map control works with http authentification too?

Thanks in advance.

Roland K.

Re: .NET Map control with http authentification

Posted: Thu Dec 18, 2014 1:42 pm
by Oliver Heilig
Hello Roland,

you can specify a user/pwd for xServer requests with the users.properties file, which enforces HTTP basic authentication for requests. A good resource for samples how a client can access xServer with basic authentication is the xServer internet devloper guide.

http://xserver.ptvgroup.com/se/cookbook/home/

While xServer internet is a cloud-based xServer, it uses the same (basic HTTP) authentication method as a self-hosted xServer with the users.properties file. This means you can apply all the samples explained there, but you have to replace the term "xtok" with your user and the token with your password. For expample: If you want to use the MapControl with your basic-auth xMap, you have to set the property XMapCredentials to "myUser:myPwd", see

http://xserver.ptvgroup.com/se/cookbook ... ctive-map/

If you experience issues when using xServer.NET 1.3 with your self-hosted xServer, you should check if this is resolved with the latest build. You can download the latest build here

https://github.com/ptv-logistics/xservernet-bin

we fixed some issues for basic authentication and reverse proxy scenarios there. Just replace your Ptv.XServer.Controls.Map.dll with the one inside the Lib folder. We'll release a new SDK version with all the fixes beginning next year.

Best regards

Oliver

Re: .NET Map control with http authentification

Posted: Fri Dec 19, 2014 12:16 pm
by RolandK
Hello Oliver!

Thanks for your quick help, but unfortunately i still get an error.

If i use the following properties, it works:

XMapCredentials: user:password
XMapUrl: http://127.0.0.1:50010/xmap/ws/XMap

But if i change the ip-address in the XMapUrl to the public ip-address of our productive server, i get an ArgumentOutOfRangeException with following message (in german):
"Der Index lag außerhalb des Bereichs. Er darf nicht negativ und kleiner als die Auflistung sein."
Parametername: startIndex"


Best Regards

Roland

Re: .NET Map control with http authentification

Posted: Tue Dec 23, 2014 9:17 am
by Oliver Heilig
Hallo Roland,

cannot reproduce it. If i set the properties like

Map.XMapUrl = "http://80.146.239.180:80/xmap/ws/XMap";
Map.XMapCredentials = "just:atest";

on our external server, everything works fine. How can i reproduce it?

Re: .NET Map control with http authentification

Posted: Tue Dec 23, 2014 10:09 am
by Oliver Heilig
Hi Roland,

the control tries to read the attribution text and configuration parameters at initialization from the server, and it looks like something goes wrong there. We've added a check for an error at the initialization. Can you test if your code runs with the latest MapControl DLL?

https://github.com/ptv-logistics/xservernet-bin

Re: .NET Map control with http authentification

Posted: Tue Dec 23, 2014 12:26 pm
by RolandK
Hi Oliver!

Now it works! Thank you!

Re: .NET Map control with http authentification

Posted: Tue Dec 23, 2014 3:34 pm
by Oliver Heilig
Good to hear!

Merry christmas and a happy new year 2015

Oliver