use the FileSystemWatcher class to document the user who is making changes

时光总嘲笑我的痴心妄想 提交于 2020-02-02 11:07:31

问题


I have a console app that checks for changes occurring on the file system. I'm trying to find out if it's possible to get the username of the individual who is doing the changes?


回答1:


You'd be better off enabling auditing on the folder.

Right-click the folder, go to Properties > Security tab > Advanced > Auditing tab. There are options for recording an audit log of events that happen in that folder.




回答2:


No, it's not possible, the NTFS or FAT file system which is what Windows uses doesn't record this information. The best you could get about a file is last time it was changed.




回答3:


You can't do this asynchronously with FileSystemWatcher, however you can do this synchronously using file system filter driver. The driver lets you get the user name of the account performing the operation.



来源:https://stackoverflow.com/questions/8649661/use-the-filesystemwatcher-class-to-document-the-user-who-is-making-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!