How do I programmatically change the security attributes of a file so that any user can delete the file

前端 未结 2 603
长情又很酷
长情又很酷 2020-12-11 07:18

I have a server written in C# that makes use of impersonation.

I would like to know how I can change the security attributes of a file so that any user can delete it

2条回答
  •  执念已碎
    2020-12-11 08:10

    It sounds like you want to use the System.IO.File.SetAccessControl method to add an ACL that gives the built-in "Everyone" group the ability to delete the file. The MSDN documentation has a decent sample of adding and removing ACL records on a file.

提交回复
热议问题