ADODB - Safety settings on this computer prohibit accessing a data source on another domain

M

mmq

Having spend a few days trying to track down this issue, I now hope for
assistance from other people.

I'm writing a simple AJAX control to enable file-upload using AJAX
technologi (and MS ADO).

The following javascript code is causing the issue:
var adoStream = new ActiveXObject("ADODB.Stream");
//adoStream.Mode = 1; // read only , 3 read write
adoStream.Type = 1; // adTypeBinary
adoStream.Open();
adoStream.LoadFromFile(filename); <--- THIS IS WHERE THE ERROR
OCCUR

When I run the javascript on my local computer it works fine, but when
downloaded from a remote-web site it fails with the error "Safety
settings on this computer prohibit accessing a data source on another
domain".

The remote server is in the Intranet Zone (added through security
settings), and "Access data sources across domains" is set to Enable in
Miscellaneous Security Settings.

No luck so far.

I'm on a Windows 2003 server running IE 6.0 SP1.

Any ideas very much appreciated. I cannot understand why it can be so
difficult to find out where the problem is :-(
 
?

=?iso-8859-1?B?RnLpZOlyaWMgIFZhY2hvbg==?=

If you have the possibility to have a JS file on the client machine,
trough installation process or else, do this:

var wsShell = new ActiveXObject("WScript.Shell")
wsShell.run("wscript.exe \"C:\\Program Files\\CompanyX\\Local
Scripts\\DoThatFunkyStuff.js\"")

Where your ADODB.Stream code is in the JS file.

One usefull trick is to write a XML file to the client machine where
you have data required in the JS file.

var objFSO = new ActiveXObject("Scripting.FileSystemObject");
objFSO.CreateTextFile("c:\\Temp\\FunkyData.xml").Write(xmlData);

Hope it helps, have fun...
 
M

mmq

Thanks for the input.

As I understand your copy, I should create a JS file that can be
executed. As this JS file need various parameters from my code I need
to create a new file (the XML file) with the parameters for the local
JS file. This local JS file will then read information using ADODB and
upload data to the server.

Seems a bit awkward way to do it this way.

Any idea why IE return that error - and how it can be avoided?

Morten
 
M

mmq

For anyone interested please refer to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/ado28_dcrs.asp.

"For the ADO Stream object, if the LoadFromFile or SaveToFile methods
are used.
For these limited sets of potentially disk-accessible functions, the
following behavior now occurs for MDAC 2.8, if any code that uses these
methods is run in Internet Explorer:

* If the site that provided the code was added previously to the
Trusted Sites zone list, the code executes in the browser and access is
granted to local files.
I*f the site does not appear in the Trusted Sites zone list, the code
is blocked and access to local files is denied."

So it seems that it should be supported.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top