Mat*_*i24 1 c# permissions explorer
如何禁用文件夹的继承并删除所有继承的权限
谢谢
我试过这个:
DirectoryInfo dInfo = new DirectoryInfo(path);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
dSecurity.SetAccessRuleProtection(false, false);
Run Code Online (Sandbox Code Playgroud)
如果有人搜索解决方案:
DirectorySecurity directorySecurity = Directory.GetAccessControl(path);
directorySecurity.SetAccessRuleProtection(true, keepPermissions);
Directory.SetAccessControl(path, directorySecurity);
Run Code Online (Sandbox Code Playgroud)
如果要保留继承的权限,则 keepPermissions 为 true。
| 归档时间: |
|
| 查看次数: |
3811 次 |
| 最近记录: |