2011-03-03 29 views
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 

回答

1

原来我用的是IP地址在我的模拟域,而不是友好的域名。 一旦我使用友好的域名,模拟工作。