Hojoformo
asked on
Permission denied Error with objFSO.OpenTextFile
I am trying to write out file from my classic asp program and keep getting a "permission deined error" when I try to open the file for writting. I am not sure if this is really a server permsisson problem or a bug in my code. I do have permsission to create files so this error does not make any sense.
Line 354 - Set objTextFile = objFSO.OpenTextFile(strDir ectory, ForAppending, True)
Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied
/Apogee/residential/accoun t_history. asp, line 354
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
My Code:
Dim objFSO, objFSOText, objFolder, objFile
Dim strDirectory, strFile
Const ForAppending = 2
set objFile = nothing
set objFolder = nothing
strFile = "Base64Data.txt"
strDirectory=server.mapPat h(strFile)
' Create the File System Object
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Set objFile = objFSO.CreateTextFile(strD irectory)
Set objTextFile = objFSO.OpenTextFile(strDir ectory, ForAppending, True)
Base64Data = oXML.xml
Base64Data = Base64EncodeBinary(oXML.xm l)
objTextFile.WriteLine(Base 64Data)
objTextFile.Close
Line 354 - Set objTextFile = objFSO.OpenTextFile(strDir
Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied
/Apogee/residential/accoun
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
My Code:
Dim objFSO, objFSOText, objFolder, objFile
Dim strDirectory, strFile
Const ForAppending = 2
set objFile = nothing
set objFolder = nothing
strFile = "Base64Data.txt"
strDirectory=server.mapPat
' Create the File System Object
Set objFSO = CreateObject("Scripting.Fi
Set objFile = objFSO.CreateTextFile(strD
Set objTextFile = objFSO.OpenTextFile(strDir
Base64Data = oXML.xml
Base64Data = Base64EncodeBinary(oXML.xm
objTextFile.WriteLine(Base
objTextFile.Close
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try changing the permissions to everyone (you said that works), then change them back to IUSR_machine. Sometimes that does it.
Also, if you're changing permissions in Windows Explorer, try changing them in both IIS and Windows Explorer. Sometimes I have to do that. It's a royal pain, but I haven't found a way around it.