當我試圖剪切和粘貼目錄(子文件夾和文件),它給了我錯誤訪問路徑被拒絕。有時它會在我將任何文件上傳到該目錄時發揮作用,然後顯示錯誤。訪問路徑被拒絕移動使用c目錄#
我可以完全訪問該目錄和子目錄。 我能夠刪除和上傳該目錄下的文件,但無法將該目錄移動到任何其他位置。
我曾嘗試:
- 網絡服務,每個人都完全訪問。
- 更新應用程序池的標識。
我也試過這種
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;
}
如果有爲什麼我收到此錯誤,請讓我知道什麼想法。
請顯示您的代碼。 – Blorgbeard
錯誤來自生產或本地主機? – Gajendra
您是否嘗試模擬爲IIS用戶http://technet.microsoft.com/zh-cn/library/cc730708(v=WS.10).aspx –