Avatar of Dirar Abu Kteish
Dirar Abu KteishFlag for Palestine, State of

asked on 

Load xml with asp extension

Hi,

I am trying to load an xml file with asp extension, i.e sqlXml.load("path/myfile.asp")... It's working fine when the extension is xml, but I have problem loading it with asp extension.
I know that the problem is because I am trying to load the asp file from a physical path and not through HTTP, but I am not sure how to load the xml from HTTP cuz I am loading the xml from global.asa and the path is not always the same...

appreciate any help

Thanks
ASPXML

Avatar of undefined
Last Comment
Dirar Abu Kteish
Avatar of Badotz
Badotz
Flag of United States of America image

So, why change the extension from .xml to .asp? Leave it alone!
Avatar of B_Dorsey
B_Dorsey

before the
sqlXml.load("path/myfile.asp")

put
sqlXml.setProperty "ServerHTTPRequest", true

and make sure you include the http://mydomain.com/mypath/to/the/asp/file.asp
Avatar of Badotz
Badotz
Flag of United States of America image

Yeah, but if it ain't broke, why fix it?
Avatar of B_Dorsey
B_Dorsey

i think what he is saying is that he has tried using a xml file and it works but as soon as he tried to create a dynamic XML file with ASP it doesnt work, but he knows for the ASP to execute correctly it has to be called via http

b
Avatar of Badotz
Badotz
Flag of United States of America image

gotcha - well, until we hear back from dxz2, we won't know what he is thinking ;-)
Avatar of Dirar Abu Kteish

ASKER

Hi,

I will try B_Dorsey suggestion tomorrow at work.
Why changing xml to asp? because there is sensitive data inside the xml file and I created some kind of server side authentication to disable xml file to be directly viewed in browsers

B_Dorsey what do you mean by "and make sure you include the http://mydomain.com/mypath/to/the/asp/file.asp"

Thanks

-dirar
Avatar of Badotz
Badotz
Flag of United States of America image

>> cuz I am loading the xml from global.asa

That is pretty secure, no?
Avatar of Dirar Abu Kteish

ASKER

Hi B_Dorsey,

This is what I am doing:

Set sqlXml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
path = Server.MapPath("../../xml/DBQUERY.xml")
sqlXml.setProperty "ServerHTTPRequest", true
sqlXml.load path

did not work

I then added:
sqlXml.async = false
sqlXml.validateOnParse = false

And it worked

Thanks a lot the sqlXml.setProperty was I am missing
Avatar of Dirar Abu Kteish

ASKER

:) my bad I am sorry

no it didn't work till now I thought I changed the path
should be
path = Server.MapPath("../../xml/DBQUERY.asp")


any suggestions
Avatar of B_Dorsey
B_Dorsey

a ASP page needs to be executed.. I didnt know you could use ../ in Server mappath... so try the suggestions below...


Set sqlXml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
sqlXml.setProperty "ServerHTTPRequest", true
sqlXml.Load Server.MapPath("/xml/DBQUERY.asp")

Set sqlXml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
sqlXml.setProperty "ServerHTTPRequest", true
sqlXml.Load Server.MapPath("http://www.mydomain.com/xml/DBQUERY.asp") 'Replace my domain with the domain name

Avatar of Dirar Abu Kteish

ASKER

I get "Invalid xml declaration" I think this is because of the <%%> in asp

-dirar
ASKER CERTIFIED SOLUTION
Avatar of B_Dorsey
B_Dorsey

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Dirar Abu Kteish

ASKER

I gad to start the document with
<?xml version="1.0" encoding="utf-8"?>

instead with <%%>

and it worked

thanks
ASP
ASP

Active Server Pages (ASP) is Microsoft’s first server-side engine for dynamic web pages. ASP’s support of the Component Object Model (COM) enables it to access and use compiled libraries such as DLLs. It has been superseded by ASP.NET, but will be supported by Internet Information Services (IIS) through at least 2022.

82K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo