URI Error?

2882
8
12-06-2011 06:36 AM
MatthewBorr
New Contributor III
I want to run a query based on a drivetime gp polygon in my own app, similar to the "Select features within a two minute drive time" Sample. However when I do so, I get this error in firebug:

Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5 Line: 14"]

If I copy and paste the entire code from the sample into a local file and run it, I get the same error.

Anyone run into this error?
0 Kudos
8 Replies
derekswingley1
Frequent Contributor
You see that error consistently when running this sample:  http://help.arcgis.com/en/webapi/javascript/arcgis/demos/fl/fl_selection.html ?

The sample requires a proxy. Do you have one set up when running it locally?
0 Kudos
MatthewBorr
New Contributor III
Yes, the proxy URI was doing it. Do I put the proxy page on my local machine then?
0 Kudos
derekswingley1
Frequent Contributor
Do I put the proxy page on my local machine then?


Yes. Check out the proxy page topic in the help for info on how to do this.
0 Kudos
MatthewBorr
New Contributor III
Question then: The help topic gives instructions for web server proxies. Where would I put the proxy page on my local development machine? (and which version - PHP, asp, or Java).

I will eventually move my app to a web server, but I am developing locally for now.
0 Kudos
derekswingley1
Frequent Contributor
You need to have a web server on your dev machine to use the proxy. There's no easy way around this.

Just to be clear, you're not using URLs like http://localhost/some/folder/sample.html when running stuff on your dev machine?

I would encourage you to set up a web server on your dev machine. It's pretty straight forward and free for all operating systems.
0 Kudos
MatthewBorr
New Contributor III
I guess I need a testing server then; I thought maybe there was a way around that. I'll do that! Thanks.
0 Kudos
derekswingley1
Frequent Contributor
No need for an additional server, you can set up a web server on the machine where you're currently running samples. For windows, look into installing IIS or Apache. For OS X, apache is installed by default. For linux...well, there are too many options to list.
0 Kudos
JayGregory
New Contributor III
Matthew, did you ever get this issue resolved?  I'm getting the same error as you:

Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5 Line: 14"]

even after running through the instructions of setting up a local proxy server. 

See this post: 54811-Proxy-page-error-using-editor-widgit for details.
0 Kudos