I have a network share watched by a FileSystemWatcher object...

If multiple users on a windows domain have access to copy files to this share, is it possible, using the FileSystemWatcher object, or otherwise, to get credentials of a person who copied the file to this network share and how?

有帮助吗?

解决方案

I used FileInfo.GetAccessControl method to get FileSecurity object. Using GetOwner method of that FileSecurity object you can get the Principal.NTAccount object to get the NT user...

var fi = new FileInfo(filePath);
var ac = fi.GetAccessControl();
var owner = ac.GetOwner(typeof (System.Security.Principal.NTAccount)).Value;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top