Jonathan Smith
Jonathan Smith

Reputation: 2599

Getting "Permission Denied" in classic ASP using CopyFile

I am trying to copy a file from a network share on a Server 2008 box, onto a 2003 server.

The classic asp page runs on the 2003 server. I have added a virtual directory in IIS that points to the required folder on the 2008 server. I have set the anonymous user on the directory security tab to be a user on the 2008 server and the "Connect As:" user on the Virtual Directory tab. When i try to use CopyFile, i get permission denied. Any ideas how i can fix / troubleshoot this?

TIA

Upvotes: 1

Views: 1231

Answers (1)

AnthonyWJones
AnthonyWJones

Reputation: 189555

When you configure the "Connect As" for a UNC physical folder you specifying how IIS should attempt to read the file when it is requested by the client. However when ASP code is executing else where on your site and it attempts to access that UNC the standard Windows file security is used. Hence the current user security token that the thread processing the ASP request is running needs all the appropriate access.

Your ASP file will need to run using a security token that can read the source UNC, read and execute the ASP from its folder and has write access to the CopyFile destinition. For example you can override the anonymous user directly on the ASP file specifying a domain user account that has been granted all the foregoing access.

Upvotes: 2

Related Questions