Pergunta

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?

Foi útil?

Solução

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;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top