【发布时间】:2011-03-03 17:27:03
【问题描述】:
模拟似乎无法使用 File.OpenRead() 处理 UNC 路径是否有原因? 我正在使用CodeProject's Impersonation utility:
我有一个用户有权访问我传递给 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
【问题讨论】:
标签: asp.net networking impersonation unc