Classic ASP & XML load -> write -> save -> load
I tried to modify a xml with Classic asp and then save it. The problem when i save the file on other directory it had no problem. but when i tried to save it to the same file it gives me an error
Dim metacachexml
Set metacachexml=Server.CreateObject("Microsoft.XMLDOM")
metacachexml.async=false
metacachexml.load("c:\inetpub\wwwroot\metacache.xml")
If metacachexml.parseError.errorcode<>0 then
response.write("fail")
Else
response.write("succeed <br />")
End if
Set objRoot = metacachexml.documentElement
response.write objRoot.text
Set objMETA = metacachexml.createElement("META")
objRoot.appendChild objMETA
Set objID = metacachexml.createElement("ID")
objMETA.appendChild objID
objID.Text = metaid
Set objNAME= metacachexml.createElement("NAME")
objMETA.appendChild objNAME
objNAME.text= Request.form("metaname")
Set objCONTENT = metacachexml.createElement("CONTENT")
objMETA.appendChild objCONTENT
objCONTENT.text = request.form("content")
metacachexml.Save "c:\inetpub\wwwroot\metacache.xml"
'this one succeed metacachxml.Save "c:\test.开发者_Python百科xml"
Set objRoot = Nothing
Set objMeta = Nothing
Set objID = Nothing
Set objNAME = Nothing
Set objCONTENT = Nothing
Set metacachexml = nothing
I want to overwrite the existened file. Can someone help me?
Thanks
Check for:
- Isn't the file open by another process?
- Isn't the file read-only?
- Do you have ACL permission to write to the folder AND file (the file may have different ACL than the folder)
精彩评论