感谢您的快速响应。但我只是登录而已。即时通讯使用下面的代码来尝试登录:将文件从远程服务器复制到本地,反之亦然
bool success = LogonUser("username", "000.000.000.000", "#####",2 ,0 , out userToken);
但即时得到例外的使用用户名和PWD我使用通过MSTSC登录失败 IM。
我写代码将文件从远程机器复制到本地机器,反之亦然。 但我不是能够知道我可以指定凭据这样做.. 我的代码如下:
string sourceFile = System.IO.Path.Combine(globalInfo.GlobalServerPath, sourcePath));
string destFile = System.IO.Path.Combine(globalInfo.GlobalPath, destPath)
string[] files = System.IO.Directory.GetFiles(sourceFile);
foreach (string s in files)
{
string fileName = System.IO.Path.GetFileName(s);
fileName = System.IO.Path.Combine(destFile, fileName);
System.IO.File.Copy(s, fileName, true);
}
在这里,我得到错误:无法登录..
线路
string [] files = System.IO.Directory.GetFiles(sourceFile);
即时连接到远程机器。
请帮
您没有相应的登录权限。您需要指定包含凭据的UNC路径。 – Polynomial