AmazingAnt

I need to share a drive over the network, and then set the shared drive to not allow anyone to edit inside files inside said drive.
This is easy enough to do when you right click on a drive, open the "Sharing and Security" option, and uncheck the "Allow other users to change my files" option, but I need to be able to do this in a program.
Sharing a drive is easy enough through the net share command, but I still don't know how to disallow editing.
I'm assuming this is somewhere in the registry, but don't know for sure. Anyone know

Thanks in advance!



Re: Visual C# Express Edition Disallow file editing on shared drive

rauhanlinnake

The directory and file right are placed in the file system, not in registry. You can alter the ACL of certain directories if you have rights to do so.

You can alter the access control of a directory using DirectoryInfo.SetAccessControl method.




Re: Visual C# Express Edition Disallow file editing on shared drive

AmazingAnt

Intervesting.... Yes, I would assume I have the rights to do so, as I am sharing a directory contained within the My Documents folder for my user account, as a strange bizzare little experiment I'm doing, but I shall follow this SetAccessControl method you speak of.

Thanks!