hi i am working on c# project and i try to lock a file from being opened , copied or even deleted by using that code :
FileInfo fi = new FileInfo(textBox1.Text);
FileSecurity ds = fi.GetAccessControl();
ds.AddAccessRule(new FileSystemAccessRule("Authenticated Users", FileSystemRights.FullControl, AccessControlType.Deny));
fi.SetAccessControl(ds);
but when i open the file , it is opened and can be deleted , is there anything wrong on my code ?
by the way , that code works perfectly on anywhere but flash drive , i can block editing or copying files from computer , but on flash drive the application is useless .