How to prevent computer users from changing file permissions in the
security tab. C#
this is my first question in this website.
i am trying to prevent read/write access to a file (or folder) with C#.
The file is being locked as it is supposed to but the problem is that i
can easily go to the security tab abd change the permissions. How can i
prevent all computer users from changing these permissions ?
The Code i am using is this (Based on an article from MSDN) :
DirectorySecurity fs =
System.IO.Directory.GetAccessControl(textBox1.Text); fs.SetAccessRule(new
FileSystemAccessRule("Users", FileSystemRights.Modify |
FileSystemRights.ReadPermissions | FileSystemRights.TakeOwnership |
FileSystemRights.ChangePermissions, AccessControlType.Deny));
System.IO.Directory.SetAccessControl(textBox1.Text, fs);
Thank you in advance...
Rafael
No comments:
Post a Comment