Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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!

share|improve this question
    
serverapi.arcgisonline.com/jsapi/arcgis/3.5 is the javascript and see forums.arcgis.com/threads/… for proxy setup –  Mapperz May 13 '13 at 20:29
    
@Mapperz if you put this as an answer I'll mark it as the right answer. –  Mike Marks May 13 '13 at 20:38
    
thank you for the info as well –  Mike Marks May 13 '13 at 20:38
    
added as an answer on @Mike Marks request –  Mapperz May 13 '13 at 20:57
add comment

1 Answer 1

up vote 5 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.