How to remove "Read only" property for a Folder using .net(Windows application using c#)
how to remove "Read only" property for a Folder using .net(Windows application using c#)
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Feb 9, 2012, 1:41 AM
DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl();
FileSystemAccessRule fc = (new FileSystemAccessRule("EveryOne",FileSystemRights.FullControl, AccessControlType.Deny));
// here you wrote ur Group/Username like Authenticated User or SYSTEM insted of everyone
myDirectoryInfo.SetAccessControl(myDirectorySecurity);
myDirectorySecurity.RemoveAccessRule(fc);
myDirectorySecurity.AddAccessRule(new FileSystemAccessRule(User,FileSystemRights.FullControl, AccessControlType.Allow));
myDirectoryInfo.SetAccessControl(myDirectorySecurity);
MessageBox.Show("Changed Permissions Successfully");