.NET Map control with http authentification

Within this forum we want to offer discussions all around our .NET based Map control including all .Net-language specific questions concerning calls of the xServer-API. Attention: xServer-relevant concepts can be found in further forums such as xRoute or xTour.
Post Reply
RolandK
Posts: 5
Joined: Wed Dec 17, 2014 8:20 am

.NET Map control with http authentification

Post 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.
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: .NET Map control with http authentification

Post 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
RolandK
Posts: 5
Joined: Wed Dec 17, 2014 8:20 am

Re: .NET Map control with http authentification

Post 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
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: .NET Map control with http authentification

Post 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?
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: .NET Map control with http authentification

Post 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
RolandK
Posts: 5
Joined: Wed Dec 17, 2014 8:20 am

Re: .NET Map control with http authentification

Post by RolandK »

Hi Oliver!

Now it works! Thank you!
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: .NET Map control with http authentification

Post by Oliver Heilig »

Good to hear!

Merry christmas and a happy new year 2015

Oliver
Post Reply