Reputation: 542
I'm writing a repository in ASP classic (using JScript) running on IIS 7.0 and I'm having some trouble with permission when moving files around. I have to following generic function that always gives me a permission denied error.
function moveFile(source, target){
fs = new ActiveXObject("Scripting.FileSystemObject");
newloc = target + "\\" + source.name;
debug("Copying file: " + source.path + " to " + newloc);
fs.copyFile(source.path, Server.MapPath( "repository/" ), true);
}
When I call the function with with source source.path
being D:\Inetpub_EXT\wwwroot\builder\repo\dump\alicia.docx
and target being D:\Inetpub_EXT\wwwroot\builder\repo\repository
I get the following output:
Treating dumpfile: alicia
Copying file: D:\Inetpub_EXT\builder\repo\dump\alicia.docx to
D:\Inetpub_EXT\wwwroot\builder\repo\repository
Microsoft JScript runtime error '800a0046'
Permission denied
I've verified that both the folder and file exist and I gave full control to IIS_WPG, IUSR, Authenticated User, System and Administrators in builder.
Thanks for your help.
Upvotes: 1
Views: 1207
Reputation: 192467
Double check your permissions. Be careful of assumptions.
For example you may be assuming that if the IIS user has permissions on the builder
directory, then it has permissions on all subdirectories. This is not a good assumption.
If you set the ACL on the builder
directory to give IIS permissions, after having created the subdirectories, then those subdirectories won't automatically inherit the permissions that you later applied to builder
.
You can use icacls.exe from the command line to view the permissions:
%windir\system32\icacls.exe d:\inetpub\wwwroot\builder\foo\bar
Upvotes: 1