简体   繁体   中英

Access Denied to "Documents" in C# (and pretty much any other folder)

I've already read a lot about this and after several hours I still cant fix it. This is the fragment of the code that matters:

    void CopiarMover(string file) 
    {
        File.Copy(@"C:\\Users\\Daniel\\Documents", "../../contenidos/" + file);
    }

I've already configured my app manifest to:

<requestedExecutionLevel level="highestAvailable" uiAccess="false" />

And it keeps returning errors (permission denied). I'm using Win7. Any ideas on how to fix this?

Any reason why you didn't specify the filename for the source?

Like this:

void CopiarMover(string file) 
{
    File.Copy(@"C:\\Users\\Daniel\\Documents\\" + file, "..\\..\\contenidos\\" + file);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM