writing a xml-file with vb.net and opening it with javascript

M

Martin Beering

hi to all,

I do have a really big problem. I am writing a xml-file
with the following vb.net.code


Dim xmlfile As String = "C:\Inetpub\wwwroot\Kostenrechnung\myXML.xml"
......
DS.WriteXml(xmlfile)


The I am trying to open the file with the following JavaScript-Code because
I would like to use the data with svg.


loadXML("C:\\Inetpub\\wwwroot\\Kostenrechnung\\myXML.xml");

function loadXML(xmlFile)
{
xmlFile=""+xmlFile;
xmlPresented=false;
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);
xmlObj=xmlDoc.documentElement;
bAnzahl=xmlObj.childNodes.length; // Anzahl der Jahre / Balken
}

Unfortunally I am always getting the error-message: Error: access denied.

If I use the following code for opening the xml-file everything works fine

loadXML("myXML.xml");

Has anybody an idea what the prolbem is ?
I am thankful for any tip.

many thanks and greetings from bremen (germany)
Martin Beering
 
D

Dag Sunde

Martin Beering said:
hi to all,

I do have a really big problem. I am writing a xml-file
with the following vb.net.code


Dim xmlfile As String = "C:\Inetpub\wwwroot\Kostenrechnung\myXML.xml"
.....
DS.WriteXml(xmlfile)


The I am trying to open the file with the following JavaScript-Code because
I would like to use the data with svg.


loadXML("C:\\Inetpub\\wwwroot\\Kostenrechnung\\myXML.xml");

function loadXML(xmlFile)
{
xmlFile=""+xmlFile;
xmlPresented=false;
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);
xmlObj=xmlDoc.documentElement;
bAnzahl=xmlObj.childNodes.length; // Anzahl der Jahre / Balken
}

Unfortunally I am always getting the error-message: Error: access denied.

If I use the following code for opening the xml-file everything works fine

loadXML("myXML.xml");

Has anybody an idea what the prolbem is ?
I am thankful for any tip.

As a security measure, JavaScript does not let you access resources
from a different site than where your page originated.

function loadXML(xmlFile)

will load it from the "current directory relative to where the document
came from, and is considered the "same site".

"C:\\Inetpub\\wwwroot\\Kostenrechnung\\myXML.xml" is considered to be
another
"site", and cross-domain access is forbidden in JS.
 

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

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top