从模板中获取文件数组作为模拟用户

时间:2014-05-08 13:32:07

标签: c# directory impersonation

如何获取模拟用户可见的文件?下面的代码为我提供了所有文件,即使被模拟的用户不应该阅读它们。

using (WindowsImpersonationContext impersonatedUser = Identity.Impersonate())
{
    string[] files = Directory.GetFiles(@"C:\Folder");
}

变量Identity是WindowsIdentity

0 个答案:

没有答案