[GIS] ArcGIS Server Setting proxy.ashx with ArcGIS API for JavaScript gives Error 403

arcgis-javascript-apiarcgis-server

I am trying to set up the proxy for my web application because the request exceeds 2000 characters. I set up the proxy as described in ESRI site. When I run my application I get the error as shown below

**"Unable to load http://localhost/proxy.ashx?http://T...nction/execute Status:403"**

I put my web application (one HTML page with javascript api code) and the two proxy files to my development machine's root folder. This machine is XP.

I have Geoprocessing service running on another machine (TestServer). When the length of GP request exceeds the limit, the application tries to use proxy and that is when I see the error above. This machine is Win 2008.

Status 403 is Forbidden page error.

Best Answer

Have you created an application, in IIS manager, using the folder that the proxy is located? If the folder is say agsproxy then you would have

http://localhost/agsproxy/proxy.ashx?

In the javascript, you would have

esri.config.defaults.io.proxyUrl = "/agsproxy/proxy.ashx";

You may want to use CORS though now.. removing the need for proxy (better performance)

//add CORS servers
esri.config.defaults.io.corsEnabledServers.push("YOURTESTSERVER");
esri.config.defaults.io.corsEnabledServers.push("sampleserver1a.arcgisonline.com");
esri.config.defaults.io.corsEnabledServers.push("sampleserver6.arcgisonline.com");
esri.config.defaults.io.corsEnabledServers.push("tasks.arcgisonline.com");
esri.config.defaults.io.corsEnabledServers.push("server.arcgisonline.com");
Related Question