how to create password to folder using c#

2020-04-11 04:15发布

问题:

how to create password to windows folder using c#

shall I set password to folders when it is created.

回答1:

You can't set a password on a folder in either FAT32 or NTFS, however you can set up so that only certain user accounts can access it using the DirectorySecurity class. There's some sample code in that link.



回答2:

Something like this cannot be done using C#. The only real reliable way of achieving something like this is to write a kernal-mode File System Filter Driver. If you install the WDK there is an example called minispy Minifilter Sample which would be a good starting point for you.