开发者

.NET How to Stop a user from deleting the file?

开发者 https://www.devze.com 2023-03-11 16:29 出处:网络
开发者_如何学运维I got this exam question \"How to Stop a user from deleting the file?\" I assume I should use some permission attribute, but which?Use FileInfo and set its .IsReadOnly property.
开发者_如何学运维

I got this exam question "How to Stop a user from deleting the file?" I assume I should use some permission attribute, but which?


Use FileInfo and set its .IsReadOnly property.

        Dim fi As New FileInfo("c:\temp\temp.txt")
        fi.IsReadOnly = value


You cannot prevent a user with administrative rights from deleting a file. After all, he can overtake the file's ownership and change the permissions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号