开发者

how to set for everyone all permissed in shared folder

This is my code to set access rules for folder -

 FileSystemSecurity fs = File.GetAccessControl(FilePath); 
 fs.AddAccessRule(new FileSystem开发者_如何学CAccessRule("everyone",  
            FileSystemRights.FullControl, AccessControlType.Allow)); 
 File.SetAccessControl(FilePath, fs); 

"Everyone" gets only read Permission


Why are you Denying permissions if you want to give permissions? If I understand your question you wants to give full control to everyone? If so the following should work:

FileSecurity fSec = File.GetAccessControl(file);
fSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow));
File.SetAccessControl(file, fSec);

Edit: Or did you mean that you wanted to make sure that everyone only ever could have read permissions? If so, you'd need to do it the other way around, allow Read and deny other permissions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜