472,779 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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

I have following client side code which i have used in my asp.net
SummaryFeatured Resources from the
IBM Business Values Solution Center
CRM Done Right
Improve the likelihood of CRM success from less than 20 percent to 60

The Growth Triathlon
What factors constrain growth? And what are the levers to drive it?
Read this whitepaper to find out.

Global CEO Study 2004
Read the findings of a global survey of over 400 CEO's focusing on the
most important factors that they need to address with their

This article examines an example of multiple binary file upload for Web
applications using Extensible Markup Language (XML) technology, without
the typical limitation of traditional file upload processing. It
describes how to use Microsoft XML Parser 3.0 (MSXML) and ActiveX Data
Objects (ADO) Stream objects for a new upload strategy with several
benefits. For example, no custom ASP components are required.
To obtain a file upload with a traditional HTML page, on the client
side we can use a form structured in the following way:
<FORM NAME="myForm"
<INPUT TYPE="file" NAME="myFile">
<INPUT TYPE="submit" VALUE="Upload File">
This solution presents several limitations both on the client and
server side. We must use the POST method (because the GET can't manage
this type of data), and we have no solutions to trigger a POST
processing without using an HTML form. When we send data to the
TargetURL, the browser loads this page as the new current page and we
have an undesirable "context switch."
The ENCTYPE property defines the Multipurpose Internet Mail Extensions
(MIME) encoding for the form and must be set to "multipart/form-data"
for file upload forms. When we set this property to
"multipart/form-data" we obtain a different structure of the POST
buffer (which is also more complex) and the Request ASP object can't
access the form contents. Therefore, we can read the POST buffer using
the Request.binaryRead method, but we can't use scripting languages to
do this. The Request.binaryRead method returns a VTarray (which is a
variant array of unsigned one byte characters) while scripting
languages can manage only variant variables. We can resolve this
problem only by using a specific, custom ASP component or ISAPI
extension, such as CPSHOST.DLL. This behavior is by design.
A New Upload Strategy
The idea underlying this article is the use of the following step: On
the client-side:

create a XML document using the MSXML 3.0 object;
create a XML node with binary content;
populate this node with the content of the uploading file using the ADO
Stream object;
send the document to the Web server using the XMLHTTP object.
On the server-side:
read the XML document from the Request ASP object;
read the content of the binary node and store it into a file on the
server. Optionally, we can store it into a BLOB field of a database
Before explaining the source code sample, we can make a few
considerations about the solution used in this article.

XML Consideration
XML support many data types, such as numeric, float, character, etc.
Many authors define XML as the ASCII of the future, but we can't forget
that this technology can also describe binary information using the
"bin.base64" data type. This feature is fully available with MS XML 3.0
Parser and to date requires a custom setup. This object provides some
properties that enable a complete management of binary contents:

obj_node.dataType - This read/write property specifies the data type of
the selected node. The XML parser supports more dataType values (see
the MSDN reference for a complete list --

For binary contents we can use the "bin.base64" data type;

obj_node.nodeTypedValue - This read/write property contains the
selected node's value expressed in its defined data type.
We can create an XML document with more "bin.base64"-type nodes that
contain the files we want to upload. This consideration allows the
processing of multiple uploading files with a single POST.

We can use the XMLHttpRequest object to send an XML document to a Web
server using the POST method. This object provides client-side protocol
support for communication with HTTP servers and allows us to send and
receive MS XML Document Object Model (DOM) objects from a Web server.
XMLHttpRequest is a built-in COM object with Internet Explorer 5 (not
requiring a custom setup) and does not generate a context switch after
posting data.
The ADO Stream Object
The previous considerations allow the creation (on the client-side) of
an XML document with one or more binary nodes. Now we need to populate
this node with the contents of the uploading files. Unfortunately,
scripting languages can't access the local file system, and the
Scripting.FileSystemObject (which is a built-in COM object of the
recent Win32 platform) to date can't manage binary files. This behavior
is by design. We need an other COM object that provides the access to
the local binary files.

The ADO Stream object (which is a COM object included in the MDAC 2.5
components) provides the means to read, write, and manage a stream of
bytes. This byte stream may be text or binary and hasn't particular
size limitations. In ADO 2.5, Microsoft has introduced the Stream
object without any dependency in the ADO object model hierarchy;
therefore, we can use the Stream object without binding it to the other
ADO objects.

In this article, we use the Stream object to access file content and
store it into XML node, and vice versa.
Client-Side Code
The following code sample provides a client-side file upload using
Stream and MSXML objects:
<INPUT id=btn_send name="btn_send" type=button value="FILE SEND">
<DIV id=div_message>Ready</DIV>


// files upload function
function btn_send.onclick()
// create ADO-stream Object
var ado_stream = new ActiveXObject("ADODB.Stream");

// create XML document with default header and primary node
var xml_dom = new ActiveXObject("MSXML2.DOMDocument");
xml_dom.loadXML('<?xml version="1.0" ?> <root/>');
// specify namespaces datatypes

// create a new node and set binary content
var l_node1 = xml_dom.createElement("file1");
l_node1.dataType = "bin.base64";
// open stream object and read source file
ado_stream.Type = 1; // 1=adTypeBinary
// store file content into XML node
l_node1.nodeTypedValue = ado_stream.Read(-1); // -1=adReadAll

// we can create more XML nodes for multiple file upload

// send XML documento to Web server
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
// show server message in message-area
div_message.innerHTML = xmlhttp.ResponseText;

following error comes while debugging the above code on the line
marked with **
Safety settings on this computer prohibit accessing a data source on
another domain

How can i solve this problem

Jan 24 '06 #1
0 11925

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Sandra | last post by:
Hi all, Im new on these stuf and.... Im running this JAVASCRIPT code in my ASP page and Im getting the error: Safety settings on this computer prohibit accessing a data source on another...
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
by: Steven Baeten | last post by:
Hi All, I'm running a webpage-application where, in a aspx-page,a udl is called in vbscript in an xsl-stylesheet to access a database. When I want to execute this, I receive following error...
by: Jack Wright | last post by:
Dear All, The following is the setting on IIS on a typical Client Server we are working on Authentication Methods Anonymous access (No user name/password required to access this resource.) ...
by: Vjay77 | last post by:
As a result from who is I am getting this: > > NOTICE AND TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of high-volume, automated, electronic...
by: Chad Zalkin | last post by:
We are evaluating some old code that was written as part of our math library. This code uses some optimizations that I'm not sure are necessary or safe, but is a source of debate between my...
by: aarklon | last post by:
In the article http://en.wikipedia.org/wiki/Type_safety it is written as The archetypal type-unsafe language is C because (for example) it is possible for an integer to be viewed as a function...
by: jzlondon | last post by:
Hi, I have a question that I wonder if someone might be able to help me with... I have an application which handles real-time financial data from a third party source. The data comes in via...
by: =?Utf-8?B?VGVycnk=?= | last post by:
I am using the My.Settings object to save user settings. During testing, I want to 'zero' out what has been saved to start with the defaults again. Where doies the framwork actually persist these...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.