Solved

Permission denied Error with objFSO.OpenTextFile

Posted on 2006-11-15
3
1,261 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
  • 2
3 Comments
 
LVL 11

Expert Comment

by:kelvinwkw
Comment Utility
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
Comment Utility
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
Comment Utility
IUSR_MachineName MUST have write permission to the folder where you are trying to create the file.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now