Adding User-Agent to GetTile's webclient

4 posts, 0 answers
  1. Alaa
    Alaa avatar
    2 posts
    Member since:
    Mar 2016

    Posted 06 Mar Link to this post

    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

  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 09 Mar Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Alaa
    Alaa avatar
    2 posts
    Member since:
    Mar 2016

    Posted 09 Mar in reply to Martin Link to this post

    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
  5. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 14 Mar Link to this post

    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.
Back to Top