Developping for the translation industry RSS 2.0



 Tuesday, 06 May 2008

This code example sets the permission to create files and update them in a folder for a particular user but doesn’t propagate these permissions to the subfolders.

 

using System.Security.AccessControl;

 

System.IO.DirectoryInfo folderInfo = new System.IO.DirectoryInfo(folder);

DirectorySecurity folderSecurity = folderInfo.GetAccessControl();

 

FileSystemAccessRule rule =

      new FileSystemAccessRule(

      "Domain\\username",

      FileSystemRights.ReadAndExecute |

        FileSystemRights.AppendData |

        FileSystemRights.CreateFiles |

        FileSystemRights.Write,

      InheritanceFlags.ObjectInherit,

      PropagationFlags.None,

      AccessControlType.Allow);

 

folderSecurity.AddAccessRule(rule);

folderInfo.SetAccessControl(folderSecurity);

Tuesday, 06 May 2008 17:52:15 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.NET | C# | Code Snippet

Navigation
Advertisement
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Stanislas Biron
Sign In
Statistics
Total Posts: 135
This Year: 0
This Month: 0
This Week: 0
Comments: 1
All Content © 2017, Stanislas Biron