I Want to create a new folder with everyone access rights in "C:\Program Files" and this should work out in all OS.can any body provide your support in implementing the above scenario using C#?
Asked
Active
Viewed 207 times
1 Answers
0
Here are some sample codes:
http://www.redmondpie.com/applying-permissions-on-any-windows-folder-using-c/
This can be achieved through defining new ACL-s on folder / files.
Cheers

nBalu
- 76
- 4
-
string strPath = @"C:\Program Files\ABC"; DirectoryInfo dInfo = new DirectoryInfo(strPath); DirectorySecurity dSecurity = dInfo.GetAccessControl(); dSecurity.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.NoPropagateInherit, AccessControlType.Allow)); dInfo.SetAccessControl(dSecurity); when trying this exception is thrown – Nethaji Mar 22 '13 at 12:00