I am trying to use the code below to allow all users be able to modify a folder:
class Program
{
private const string FileName = \"test.txt\";
privat
You can use the Directory.SetAccessControl()
.
Example:
DirectoryInfo directory = new DirectoryInfo(@"C:\my\directory");
DirectorySecurity security = directory.GetAccessControl();
security.AddAccessRule(new FileSystemAccessRule(@"MYDOMAIN\JohnDoe",
FileSystemRights.Modify,
AccessControlType.Deny));
directory.SetAccessControl(security);
More details in the msdn.