This is a migrated thread and some comments may be shown as answers.

Adding User-Agent to GetTile's webclient

3 Answers 18 Views
Map
This is a migrated thread and some comments may be shown as answers.
Alaa
Top achievements
Rank 1
Alaa asked on 06 Mar 2016, 09:23 AM

Hello Telerik team

We're considering using RadMap in our new WPF application

I'm trying to add my custom webclient which uses custom user-agent and referrer

solutions i'v tried:

- adding this mechanism to getCachedTile(), but it seems not using Asyc method so it makes the progrom very laggy and slow

- adding dummy Uri in GetTile() then add tile retriever to GetCachedTileAsync(), it works but i can't cancel out-of-view tile requests after fast zoom or drag

Is there any way else to get around this issue?

regards

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 09 Mar 2016, 03:57 PM
Hello Alaa,

I am afraid that I do not completely understand what you want to achieve? Do you want to implement custom tile downloader and use it with a custom tile map source? Can you share some additional information on what exactly you want to do and also some runnable code snippets which I can try on my side? This will help me in better understanding your scenario.

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Alaa
Top achievements
Rank 1
answered on 09 Mar 2016, 05:13 PM

Hello Martin

Thank you for your attention

Yes, that's exactly what I meant

I need to implement custom tile downloader which uses my custom webclient

Or at least how to pass "user-agent" through GetTile() to HttpRequest which is in your internal tile downloader

because the thing is that our custom map provider requires specific "user-agent", like this:

HttpWebRequest vHttpWebRequest = (HttpWebRequest) WebRequest.Create(url);
vHttpWebRequest.UserAgent = ...;
vHttpWebRequest.Timeout = ...;
vHttpWebRequest.ReadWriteTimeout = ...;
vHttpWebRequest.Accept = ...;
vHttpWebRequest.KeepAlive = ...;


Regards
0
Martin Ivanov
Telerik team
answered on 14 Mar 2016, 11:01 AM
Hi Alaa,

Thank you for the additional information.

Currently, there is no way to get the WebClient which is used internally withing the tile downloader of the map and therefore you cannot directly modify the requests to the server. Also, the map doesn't provide mechanism to replace the default tile downloader. In order to pass the user agent to the server you can try to add it to the query of the request if the map service allows it. For example:

Another option could be to use the map's VisualizationLayer and visualize the tiles get through the web request as image shapes.

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Map
Asked by
Alaa
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Alaa
Top achievements
Rank 1
Share this question
or