【发布时间】:2013-04-09 17:30:34
【问题描述】:
当我尝试剪切和粘贴目录(子文件夹和文件)时,它给了我对路径的访问被拒绝的错误。有时当我将任何文件上传到该目录时它会起作用,然后它会显示错误。
我拥有对该目录和子目录的完全访问权限。 我可以删除和上传该目录下的文件,但不能将该目录移动到任何其他位置。
我试过了:
- 对网络服务和所有人的完全访问权限。
- 更新应用程序池的标识。
我也试过了
DirectorySecurity dSecurity = dInfo.GetAccessControl();
dSecurity.AddAccessRule(
new FileSystemAccessRule("everyone", FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit,PropagationFlags.InheritOnly,AccessControlType.Allow));
dInfo.SetAccessControl(dSecurity);
//move function
Source = Server. MapPath (source);
destination = Server.MapPath(destination);
If (! Directory. Exists (destination))
{
Directory.Move(source, destination);
}
catch (Exception e)
{
return e.Message;
}
如果您知道我收到此错误的原因,请告诉我。
【问题讨论】:
-
请出示您的代码。
-
错误来自生产环境还是本地主机?
标签: c# asp.net-mvc-4