开发者

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:

  1. Isn't the file open by another process?
  2. Isn't the file read-only?
  3. Do you have ACL permission to write to the folder AND file (the file may have different ACL than the folder)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜