1
是否有理由使用File.OpenRead()模拟似乎不适用于UNC路径? 我正在使用CodeProject's Impersonation utility:使用UNC路径的File.OpenRead访问。冒充不起作用?
我有一个用户的权利,我传递给OpenRead()的共享。
这是我的代码,它不是访问文件:
try
{
bool canImp = imp.ImpersonateValidUser(impUser, domain, impPwd);
FileStream fs = File.OpenRead(filePath);
logger.Debug("File stream opened...");
byte[] b = new byte[fs.Length];
fs.Read(b, 0, b.Length);
fs.Close();
// code continued