Problem to download security service layer info.

506
2
10-12-2011 07:05 AM
weiliang
New Contributor II
I try to download the layer info from our HTTP/Windows authentication REST service end point URL (e.g., http://esri.com/ArcGIS/rest/services/ServiceName/MapServer/1?f=JSON). I try to add the credential proxy page to access the page, and the page URL becomes: http://esri.com/ArcGIS/rest/services/ServiceName/MapServer/1?f=JSON&ProxyURL='../proxy.ashx' . However, it still doesn't work. Am I doing something wrong? How should I use the proxy page to download this layer info.

My code is as follows:

WebClient jsonClient = new WebClient();
jsonClient.OpenReadCompleted += new OpenReadCompletedEventHandler(WebClient_OpenReadCompleted);
jsonClient.OpenReadAsync(new Uri(layerRestUrl + "?f=JSON&ProxyURL='../proxy.ashx'", UriKind.Absolute));

Many thanks,

Wei
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
You want to prefix your service url with the proxy url.

For example:
var str = "http://serverapps.esri.com/SilverlightDemos/ProxyPage/proxy.ashx?http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/2?f=pjson";
WebClient w = new WebClient();
w.DownloadStringCompleted+= (s, e) =>
{
};
w.DownloadStringAsync(new Uri(str, UriKind.Absolute));
0 Kudos
weiliang
New Contributor II
Many thanks for your help, Jennifer.

Have a good weekend!

Wei
0 Kudos