FileInfo.CopyTo to a mapped or network drive

  • Thread starter Thread starter Tom Dacon
  • Start date Start date
T

Tom Dacon

The MSDN Library documentation tells me that CopyTo will, when run by an
elevated-trust application, copy a file to a target location. In a .Net
desktop application I have no trouble doing this in the local file system,
but I'm throwing an "access denied" exception when copying to a mapped drive
in my local file system. Defining a FullTrust security policy for the mapped
drive through the Microsoft .Net Framework 2.0 Configuration control panel
application has no effect on the problem.

What permissions do I need to have for the application, and if it can be
done through declarative security, how would I do that? Or are there
permissions I can grant using the normal file system security techniques?

Thanks,
Tom Dacon
Dacon Software Consulting
 
I should add that I have no trouble using FileInfo.CopyTo to copy a file
from my local system to another computer's file system, using a syntax like:
"\\<ip address>\C$\test.txt". It's just mapped drives in my own local file
system that are causing me problems. So the subject line is a little
incorrect: it should be "FileInfo.CopyTo to a mapped drive".

Furthermore, I've given the Users group full control of the directory that
the drive letter is mapped to, and the problem persists.

Tom
 
Back
Top