dynamic layer using a token

1165
2
Jump to solution
02-02-2012 04:41 AM
KevinLECOCQ
New Contributor III
Hi,
I'm trying to load a dynamic layer in my silverlight application, using a token.
My token contains of special characters like '/'.

When I create my ArcGISDynamicMapServiceLayer, I have to use HttpUtility.UrlEncode to convert '/' in '%2f'. Then I add my layer to my map.
This method allows to execute the request 'http://.../arcgis/rest/services/.../Mapserver?f=json&token=...' successfully.

But each next request like 'http://.../arcgis/rest/services/.../Mapserver/export?bbox=...&token=...' fails because my token is re-encoded in HTML.
For example, the character '/' become '%252f.

So, what I'm doing wrong ? Why the Silverlight API encode URLs/tokens only for requests like "export", "tile", ... and not the "MapServer" ?

Thanks 🙂
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
I have to use HttpUtility.UrlEncode to convert '/' in '%2f'.


Why do you have to use UrlEncode?

The normal behavior is that a layer such as: <esri:ArcGISDynamicMapServiceLayer Token="mytokenwith/inthemiddle" Url="http://.....    should work.

Which error do you get without using UrlEncode?

View solution in original post

0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
I have to use HttpUtility.UrlEncode to convert '/' in '%2f'.


Why do you have to use UrlEncode?

The normal behavior is that a layer such as: <esri:ArcGISDynamicMapServiceLayer Token="mytokenwith/inthemiddle" Url="http://.....    should work.

Which error do you get without using UrlEncode?
0 Kudos
KevinLECOCQ
New Contributor III
Thanks for your answer.
If I only use url="..." and token="..." without UrlEncoding, special characters (/ and +) are directly put in the url. So, I get the error :
javax.servlet.ServletException: Input length must be multiple of 8 when decrypting with padded cipher

Actually, I use an authentification filter underlying the rest API of ArcGIS Server, writter in Java. So I have to modify it.
Thanks.
0 Kudos