As title, I'd like to add a "Everyone" group to a file and give this account a full control right.
I have try to use FileSecurity class to add a account, ASPNET ,for example.
code as follow:
[code=cpp]
try
{
AddFileSecurity (@"c:\TestACL.t xt", "ASPNET", FileSystemRight s.FullControl, AccessControlTy pe.Allow);
}
catch(Exception e){
}
public static void AddFileSecurity (string filepath, string account, FileSystemRight s right, AccessControlTy pe controlType)
{
FileSecurity filesec = File.GetAccessC ontrol(filepath );
filesec.AddAcce ssRule(new FileSystemAcces sRule(account, right, controlType));
File.SetAccessC ontrol(filepath , filesec);
}
[/code]
Now, I'd like to add another account "Everyone", instead of "ASPNET" above code, but it's not work.
Have anyone get idea or can tell me this question.
Think you,
Jim.
I have try to use FileSecurity class to add a account, ASPNET ,for example.
code as follow:
[code=cpp]
try
{
AddFileSecurity (@"c:\TestACL.t xt", "ASPNET", FileSystemRight s.FullControl, AccessControlTy pe.Allow);
}
catch(Exception e){
}
public static void AddFileSecurity (string filepath, string account, FileSystemRight s right, AccessControlTy pe controlType)
{
FileSecurity filesec = File.GetAccessC ontrol(filepath );
filesec.AddAcce ssRule(new FileSystemAcces sRule(account, right, controlType));
File.SetAccessC ontrol(filepath , filesec);
}
[/code]
Now, I'd like to add another account "Everyone", instead of "ASPNET" above code, but it's not work.
Have anyone get idea or can tell me this question.
Think you,
Jim.
Comment