Saving a file

  • Thread starter Nick Warrington
  • Start date
N

Nick Warrington

Somebody let me loose with ASP and it was all going well until I hit
(what I think is ) a minor problem.

I am using IIS as a remote configuration tool to modify an XML config
file on the server. So I pull my XML config file through XSLT to give me
an HTML file with forms on. Something like this:

---8<----------------------------------------
dim objXML
dim objXSLT

set objXML = server.CreateObject("MSXML2.DOMDocument.3.0")
set objXSLT = server.CreateObject("MSXML2.DOMDocument.3.0")

objXSLT.load server.MapPath("DeviceConfiguration.xsl")
objXML.load server.MapPath("DeviceConfiguration.xml")

'just translate and pipe out the output to the browser
Response.Write(objXml.transformNode(objXSLT))
---8<----------------------------------------

I can twiddle the config values through my web browser and click
submit. Then in my save.asp I iterate over the keys in Request.Form
update my XML object and write them back to the XML file using:

objXML.save("DeviceConfiguration.xml")

Thing is, when I try and write them back I get:

Error Type:
msxml3.dll (0x80070005)
Access is denied.
/save.asp, line 24

I guess this is a configuration on IIS. Can anyone suggest what to change.

Be gentle. I only started learning about IIS and ASP last week.

Ta

Nick
 
N

Nick Warrington

Thanks for replying Brian

Okay, that seemed to work, in my world its:

objXML.save(server.mappath("/") & "/DeviceConfiguration.xml")

but nothing complained this time, it seemed to let me write back.
Brilliant. Nice one.

OK, one final question, this is how I'm I'm handling the post. Only it's
wrong! and results in a runtime error. I also started learning VBScript
this morning :)

----8<----------------------------------

set objXML = server.CreateObject("MSXML2.DOMDocument.3.0")
set objXSLT = server.CreateObject("MSXML2.DOMDocument.3.0")

objXSLT.load server.MapPath("DeviceConfiguration.xsl")
objXML.load server.MapPath("DeviceConfiguration.xml")

For Each strKey in Request.Form
Set variableNode =
objXML.selectSingleNode("/configuration/configvalues/configvalue[@name=strKey]/value")
variableNode.text = Request.Form(strKey)
Next

objXML.save(server.mappath("/") & "/DeviceConfiguration.xml")

----8<---------------------------------

I think the select single single node is ok. Is it valid to update the
node in the XML object with variableNode.text = Request.Form(strKey)? It
certainly breaks with a runtime error on this line. Will that only
update the variableNode variable or is the variable a reference to the
node in the XML obj??

Thanks again, much appreciated.

Nick
 
N

Nick Warrington

Scratch that, I just can't write vbscript and I have it working now.
Incidentally, I didn't need to set async mode for it to work.

Thanks anyway Brian. I appreciate your help.

Nick
 
B

Brian Staff

Nick,
Incidentally, I didn't need to set async mode for it to work.

Maybe it works now...but at some point, it will stop working - either due to
large XML files or just traffic.

I strongly suggest you make async=false

Brian
 
H

Holger

Nick said:
Somebody let me loose with ASP and it was all going well until I hit
(what I think is ) a minor problem.

I am using IIS as a remote configuration tool to modify an XML config
file on the server. So I pull my XML config file through XSLT to give me
an HTML file with forms on. Something like this:

---8<----------------------------------------
dim objXML
dim objXSLT

set objXML = server.CreateObject("MSXML2.DOMDocument.3.0")
set objXSLT = server.CreateObject("MSXML2.DOMDocument.3.0")

objXSLT.load server.MapPath("DeviceConfiguration.xsl")
objXML.load server.MapPath("DeviceConfiguration.xml")

'just translate and pipe out the output to the browser
Response.Write(objXml.transformNode(objXSLT))
---8<----------------------------------------

I can twiddle the config values through my web browser and click
submit. Then in my save.asp I iterate over the keys in Request.Form
update my XML object and write them back to the XML file using:

objXML.save("DeviceConfiguration.xml")

Thing is, when I try and write them back I get:

Error Type:
msxml3.dll (0x80070005)
Access is denied.
/save.asp, line 24

I guess this is a configuration on IIS. Can anyone suggest what to change.

Be gentle. I only started learning about IIS and ASP last week.

Ta

Nick

Hi, this is normally a problem with your permission rights. try one
thing. setup yout homepage on a fat32 partition. i had the same problem.
when i moved the homepage to fat32 instead of ntfs it works fine. if its
works you can go forwad an try to solve the permission rights under
ntfs. i tried it but could not solve the problem. so bevor looking for
an erro in the code you should try the homepage on a fat partition.
 

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

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top