Question

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?

Was it helpful?

Solution

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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top