문제

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