得到文件的所有者
using System;
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
FileInfo fi = new FileInfo(@"c:\1.txt");
FileSecurity fs = fi.GetAccessControl();
IdentityReference ir = fs.GetOwner(typeof(NTAccount));
Console.Write(ir.Value);
}
}
}
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
FileInfo fi = new FileInfo(@"c:\1.txt");
FileSecurity fs = fi.GetAccessControl();
IdentityReference ir = fs.GetOwner(typeof(NTAccount));
Console.Write(ir.Value);
}
}
}