【发布时间】:2017-03-19 21:34:30
【问题描述】:
我正在尝试更改 .NET Core 中文件的权限。
但是,FileInfo 似乎不再有任何SetAccessControl。
// Create a new FileInfo object.
FileInfo fInfo = new FileInfo(FileName);
// Get a FileSecurity object that represents the
// current security settings.
FileSecurity fSecurity = fInfo.GetAccessControl();
// Add the FileSystemAccessRule to the security settings.
fSecurity.AddAccessRule(new FileSystemAccessRule(Account,
Rights,
ControlType));
// Set the new access settings.
fInfo.SetAccessControl(fSecurity);
目标只是为文件的当前所有者添加执行权(这不是 Windows 或 Unix 特定的功能)。
关于如何在 .NET Core 上执行此操作的任何线索?
【问题讨论】:
-
您希望在具有不同访问控制系统的 Unix 上发生什么?还是这是一个仅限 Windows 的 .Net Core 应用程序?
-
@svick 我希望有一个共同的子集。我会检查 Mono 上做了什么(如果已经完成)。
标签: c# file-permissions .net-core