0

I trying to get list of file via Classic ASP FSO companent.

But even I gave the root file permissions (IUSR_domain) from remote desktop, still I getting this error.

Microsoft VBScript runtime error '800a0046'

Permission denied

/default2.asp, line 28

<%
fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("C:\inetpub\vhosts\xx.com\httpdocs\photo\other") <-- line 28
for each x in fo.files
%>
<div id="photos">
<div class="photo"><%Response.write(x.Name & "<br>")%></div>
</div>

<%next
set fo=nothing
set fs=nothing
%>
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • If the path is indeed correct, you'll will need to make sure that the user context the website is accessed with has at least read permission to `C:\inetpub\vhosts\xx.com\httpdocs\photo\other`. If your using Anonymous Access what is the account set to `IUSR`, or `IUSR_machinename` (the default varies with IIS versions)? – user692942 Jun 08 '14 at 18:31

2 Answers2

0

Try using Server.MapPath

for example:

    downloadFileDirectory = Server.MapPath("\httpdocs\photo\other")
          Set fs= CreateObject("Scripting.FileSystemObject")

            If fs.FolderExists(downloadFileDirectory) Then
              Set fo= fs.GetFolder(downloadFileDirectory)
                    for each x in fo.files
                    %>etc.
allski
  • 96
  • 7
  • @r.Taskiran ... is this answer helpful to you? – allski Jun 07 '14 at 14:09
  • @r.taskiran You're welcome - if it answers your question then may I kindly ask you mark the question as answered. – allski Jun 08 '14 at 14:21
  • @allski That's not going to negate the fact they haven't got permission to the folder with the user context they are using. If the OPs path was correct `MapPath` will not help as you'll will end up with the same result, `downloadFileDirectory` will be `C:\inetpub\vhosts\xx.com\httpdocs\photo\other` and the fact they don't have permission will remain. – user692942 Jun 08 '14 at 18:28
0

set IUSR_machinename and IWAM_machinename to have change permissions for the folder.

ScotterMonkey
  • 1,007
  • 12
  • 25