ObjectSecurity.GetOwner returns a group, not a user

I am trying to identify the user who created this file:

string path = "C:\\TheFile.dat";
string user = System.IO.File.GetAccessControl(path).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();

When the file was created by a user who was not a member of the Administrators user group, the user name was returned. However, when the file was created by someone who was a member of the Administrators user group, Domain \ Administrators was returned.

Can anyone think why this might happen, and how can I guarantee that the actual username will be returned?

Thank.

+3
source share
1 answer

. : " " > > > ", , , . " " - , . , . , , , .

+5

All Articles