简体   繁体   English

拒绝访问 C# 中的“文档”(以及几乎所有其他文件夹)

[英]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.我正在使用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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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