I have .net app that retrieves avialable layers and fields to populate a report. This application currently doesn't have any esri api's involved in it.
I have been getting this information using the following C# code in
mapserver r= "https://xxx.xxxxxxx.com/arcgis/rest/services/DemoMap/MapServer"
string url = mapserver + (mapserver.Substring(mapserver.Length) == "/" ? "" : "/") + "layers?f=json";
var request = WebRequest.Create(url);
"application/json; charset=utf-8";
string text; var response = (HttpWebResponse)request.GetResponse();
using (var sr = new StreamReader(response.GetResponseStream()))
{ text = sr.ReadToEnd(); }
JavaScriptSerializer jserialize = new JavaScriptSerializer();
layers mylayers = jserialize.Deserialize<layers>(text);
return mylayers;
I now have a map they wish to secure. I'm not sure how I can still retrive the information.
It intially says token missing I manually generated one and concatinated it on to the url. With that I'm getting the login page asking for userid and password.
Any help would be apprececiated.
Solved! Go to Solution.
The token worked fine. I had two issue the token was being generated off a different machine than I was accessing and the url was being generated incorrectly.
Once I corrected those issues everything was fine.
/DemoMapSecure/MapServer/layers?f=json&token=thFg7E-bxSV3rQLch0npGE5wl-kaJpGq1l4Rj0VDj12KAeG615HCneyx65QE2Flb
The token worked fine. I had two issue the token was being generated off a different machine than I was accessing and the url was being generated incorrectly.
Once I corrected those issues everything was fine.
/DemoMapSecure/MapServer/layers?f=json&token=thFg7E-bxSV3rQLch0npGE5wl-kaJpGq1l4Rj0VDj12KAeG615HCneyx65QE2Flb