Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Permission denied Error with objFSO.OpenTextFile

Posted on 2006-11-15
3
Medium Priority
?
1,282 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 1000 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 1000 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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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