FileInfo.CopyTo to a mapped or network drive


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?

Tom Dacon
Dacon Software Consulting

Tom Dacon

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.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question