0
private bool GrantAccess(string fullPath)
{
DirectoryInfo dInfo = new DirectoryInfo(fullPath);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
dSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.NoPropagateInherit, AccessControlType.Allow));
dInfo.SetAccessControl(dSecurity);
return true;
}
我正在使用这种方法删除被拒绝的权限,但它不能正常工作,请帮助解决此问题。我如何删除拒绝文件夹的权限?
你应该运行你的应用程序作为管理员!如果您正在调试,只需以管理员身份运行Visual Studio。 –