5

I'm writing a web service that will interface with ArcGIS. One of the requirements is to put:

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

in the JavaScript portion of the page. Of course, it says "esri is undefined" if I don't include the library that defines "esri". Question: Where do I get this library at? I've searched all over the internet and couldn't find anything! Thanks!

3
  • serverapi.arcgisonline.com/jsapi/arcgis/3.5 is the javascript and see forums.arcgis.com/threads/… for proxy setup Commented May 13, 2013 at 20:29
  • @Mapperz if you put this as an answer I'll mark it as the right answer. Commented May 13, 2013 at 20:38
  • added as an answer on @Mike Marks request Commented May 13, 2013 at 20:57

1 Answer 1

5

Javascript location [Current as 13/05/2013]

http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/

For the proxy settings

note the code:

esri.config.defaults.io.alwaysUseProxy = true;

<script type="text/javascript">
    dojo.require("esri.map");
    dojo.require("dijit.layout.ContentPane");
    dojo.require("dijit.layout.BorderContainer");
    var map;
    function Init() {

        esri.config.defaults.io.alwaysUseProxy = true;
        esri.config.defaults.io.proxyUrl = "http://WebServerName/proxy.ashx"; 
        dojo.style(dojo.byId("map"), { width: dojo.contentBox("map").w + "px", height: (esri.documentBox.h - dojo.contentBox("navTable").h - 40) + "px" });
        map = new esri.Map("map");

        var CountyDataLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://Server.Name/ArcGIS/rest/services/Counties/MapServer");
        map.addLayer(CountyDataLayer);

        var RestrictedLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://Server.Name/ArcGIS/rest/services/cadaster/ServiceName/MapServer");
        map.addLayer(RestrictedLayer);


        var resizeTimer;
        dojo.connect(map, 'onLoad', function(theMap) {
            dojo.connect(dijit.byId('map'), 'resize', function() {
                clearTimeout(resizeTimer);
                resizeTimer = setTimeout(function() {
                    map.resize();
                    map.reposition();
                }, 500);
            });
        });
    }
    dojo.addOnLoad(Init);
</script>

... and I used the following code in my proxy.config file:

Code:

<?xml version="1.0" encoding="utf-8" ?>
<!-- Proxy config is used to set the ArcGIS Server services that the proxy will forward to.        
        mustMatch: true to only proxy to sites listed, false to proxy to any site -->
<ProxyConfig mustMatch="true">
    <serverItems>

        <serverItem url="http://Server.Name"
                    matchAll="true" tokenUrl="http://Server.Name/ArcGIS/tokens"
                    username="MyUserName" password="MyPassword"
                    timeout="5" />

    </serverItems>
</ProxyConfig>

this code is taken from

http://forums.arcgis.com/threads/36823-How-do-you-reference-the-proxy.ashx-page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.