In C# (2.0) How do I remove all permissions to a directory, so I can limit the access. I will be adding access back to a limited set of users.
A:
Here is a great set of articles from CodeProject about Windows ACL programming:
The Windows Access Control Model
Part 3 of the series shows .NET specific methods.
Dana Holt
2009-09-18 15:52:56
A:
System.IO.Directory.GetAccessControl() and then edit the returned FileSecurity object.
codymanix
2009-09-18 15:53:26
Directory budy.
C. Ross
2009-09-18 15:57:39
nearly the same ^^ I changed it now.
codymanix
2009-09-18 16:11:00
+4
A:
Look at the classes in the System.Security.AccessControl namespace, and especially the DirectorySecurity.RemoveAccessRule method.
Also, if you remove all the permissions then you won't be able to add any back afterwards :-)
Stu Mackellar
2009-09-18 15:53:32