Solved

Permission denied Error with objFSO.OpenTextFile

Posted on 2006-11-15
3
1,278 Views
Last Modified: 2008-01-09
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(strDirectory, ForAppending, True)

Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied
/Apogee/residential/account_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.mapPath(strFile)
 
' Create the File System Object
  Set objFSO = CreateObject("Scripting.FileSystemObject")

  Set objFile = objFSO.CreateTextFile(strDirectory)
   
  Set objTextFile = objFSO.OpenTextFile(strDirectory, ForAppending, True)

  Base64Data = oXML.xml
  Base64Data = Base64EncodeBinary(oXML.xml)

  objTextFile.WriteLine(Base64Data)
  objTextFile.Close
 
0
Comment
Question by:Hojoformo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Expert Comment

by:kelvinwkw
ID: 17953008
I've had this happen too. I think it has to do with some of the latest security patches for IIS/Windows. They often seem to change permissions on the folders/files, breaking some scripts. I change permissions and they work again.

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.
0
 
LVL 11

Accepted Solution

by:
kelvinwkw earned 250 total points
ID: 17953026
Or It might be due to Script Blocking from Anti Virus You Are Using, try to disable them and give ur apps a try
0
 
LVL 58

Assisted Solution

by:amit_g
amit_g earned 250 total points
ID: 17953874
IUSR_MachineName MUST have write permission to the folder where you are trying to create the file.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question