Solved

Permission denied Error with objFSO.OpenTextFile

Posted on 2006-11-15
3
1,272 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Javascript to allow login/password authorization 4 63
Button to go back 3 44
Html fieldset fix its height and width 4 57
SP result not being displayed 5 69
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 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