C#指定某用户对某文夹件的访问权限
using System.Security.AccessControl;
//设置myFloder文件夹的iis访问权限
string userAccount = @"IIS_IUSRS";
string filePath = @"C:\inetpub\myFloder";
DirectorySecurity dSecurity = Directory.GetAccessControl(filePath,
AccessControlSections.All);
dSecurity.AddAccessRule(new FileSystemAccessRule(userAccount,
FileSystemRights.FullControl,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.None,
AccessControlType.Allow));
Directory.SetAccessControl(filePath, dSecurity);