AnsweredAssumed Answered

Secure Service get layer information with external application

Question asked by bridgji on Nov 13, 2015
Latest reply on Nov 16, 2015 by bridgji

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=  ""







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.