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