Remove All Directory Permissions

前端 未结 4 1141
情话喂你
情话喂你 2021-01-02 04:16

In C# (2.0) How do I remove all permissions to a directory, so I can limit the access. I will be adding access back to a limited set of users.

4条回答
  •  清歌不尽
    2021-01-02 04:53

    Look at the classes in the System.Security.AccessControl namespace, and especially the DirectorySecurity.RemoveAccessRule method.

    Also, if you remove all the permissions then you won't be able to add any back afterwards :-)

提交回复
热议问题