Solved

permission denied involving CreateObject("Scripting.FileSystemObject")

Posted on 2006-10-28
11
509 Views
Last Modified: 2010-08-05
code:

set fs = CreateObject("Scripting.FileSystemObject")
     set folder = fs.GetFolder(path)

     for each item in folder.SubFolders
       ListFolderContents(item.Path)
     next


This code has worked for about 6months or so on a windows 2003 server.  Any recent updates (security related maybe) that have changed the way permissions work?  I get a permission denied error on the  for each item line.

iusr machine account has read and write perms.

thanks
0
Comment
Question by:razzzzer
[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
  • 6
  • 5
11 Comments
 
LVL 25

Expert Comment

by:kevp75
ID: 17827496
>>iusr machine account has read and write perms.<<

on the folder? or in IIS?

i ask only because I never got IIS only permissions to work, I always had to make sure the folder  permissions were set as well....
0
 

Author Comment

by:razzzzer
ID: 17827943
on folder thru the file system
0
 
LVL 25

Expert Comment

by:kevp75
ID: 17828739
you'll have to show us the rest of your code.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:razzzzer
ID: 17862256
set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)

for each item in folder.SubFolders
     ListFolderContents(item.Path)
next


i get an error on the for each line... odd because this worked up until recently so i can only assume a windows update changed things or perhaps a change was made in the folder but i cannot see what that would have been....
0
 
LVL 25

Expert Comment

by:kevp75
ID: 17862682
the whole code please.  Also, the error that comes up would help  ;-)
0
 

Author Comment

by:razzzzer
ID: 17863374
well its a sub like so:
<% sub ListFolderContents(path)

     dim fs, folder, file, item, url

     set fs = CreateObject("Scripting.FileSystemObject")
     set folder = fs.GetFolder(path)

     for each item in folder.SubFolders
       ListFolderContents(item.Path)
     next

     'Display a list of files.
       theimage = galleryroot & (rsGalleryDetail.Fields.Item("fldGalleryID").Value) & "/" & (rsGalleryDetail.Fields.Item("fldGalleryPic").Value)

     for each item in folder.Files
       url = MapURL(item.path)
        
         if url <> theimage then
       %>


the error:

Microsoft VBScript runtime error '800a0046'

Permission denied

/template_gallery_detail.asp, line 219


line 219 is the for loop
0
 

Author Comment

by:razzzzer
ID: 17863399
to be more precise line 219 is

for each item in folder.SubFolders

not sure because there is so much code and functions .. hope this is enough.. it just seems to me that the permissions are not correct on the folder that this code works on but .. the iusr accounts seems fine...
0
 
LVL 25

Accepted Solution

by:
kevp75 earned 125 total points
ID: 17863484
and...are we sure that when you are calling the sub that you are passing a valid path?

and we sure that IUSR_machine name has full control on that folder?
0
 

Author Comment

by:razzzzer
ID: 17863587
adding a response.write(path) right before the for loop returns a correct path

IUSR_machine has full control on the WHOLE web folder currently
0
 

Author Comment

by:razzzzer
ID: 17863759
well even tho the check boxes were set for full permissions i went ahead and clicked on advanced permissions and check the second box "replace permission entries on all child objects with entries shown here that apply to child objects" and clicked apply and things seem to work now... i just hope i didnt open things up (made a security risk).  Big difference between a programmer and server admin ;)
0
 
LVL 25

Expert Comment

by:kevp75
ID: 17863913
honestly..if this is an upload/download directory it should be the only one to have such permissions, and even then to prevent leeching, you may want to consider moving to be in the same level as the webroot and coming up with a ado.stream script to stream the files to the browser

i do it at http://www.portalfanatic.com/gallery/?pCat=27

even the thumbnails are stored at the same level as the webroot folder and are streamed to the page via a binary write.

just food for thought  :-)

glad I could help!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 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