System.Security.AccessControl.DirectorySecurity ds = new System.Security.AccessControl.DirectorySecurity();
string useraccountForDirectoryCreate = System.Environment.UserDomainName;
ds.AddAccessRule(new System.Security.AccessControl.FileSystemAccessRule(useraccountForDirectoryCreate,
System.Security.AccessControl.FileSystemRights.FullControl,
System.Security.AccessControl.InheritanceFlags.ContainerInherit |
System.Security.AccessControl.InheritanceFlags.ObjectInherit,
System.Security.AccessControl.PropagationFlags.None,
System.Security.AccessControl.AccessControlType.Allow));
Directory.CreateDirectory(folder.Text,ds);
Directory.CreateDirectory(folder.Text + "\\timetables",ds);
我正在尝试在我的逻辑驱动器中创建一个文件夹但我不断收到异常: UnauthorizedAccessException 错误:访问被拒绝我什至以管理员身份运行仍然是相同的结果