我有一个FileSystemWatcher对象监视的网络共享...
如果 windows 域上的多个用户有权将文件复制到此共享,是否有可能使用FileSystemWatcher对象或其他方式获取将文件复制到此网络共享的人的凭据以及如何?
我有一个FileSystemWatcher对象监视的网络共享...
如果 windows 域上的多个用户有权将文件复制到此共享,是否有可能使用FileSystemWatcher对象或其他方式获取将文件复制到此网络共享的人的凭据以及如何?
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;