如何将文件从本地计算机传输到远程计算机C#

时间:2020-05-21 08:25:54

标签: c#

我想使用带有登录信息的C#将文件从本地发送到远程计算机的特定文件夹,您能否告诉我我们该怎么做。我也有IP,它实际上是Azure VM远程桌面。 我已经尝试过,但是出现错误...可以指导我进行文件传输我已经在C驱动器的VM中创建了一个文件夹

string domain = "I pass the domain name";
string userName = "Username";
string userPassword = "password";
ImpersonationHelper.Impersonate(domain, userName, userPassword, delegate
{
    string SourcePath = @"C:\Users\sabanathak\Desktop\1800199164.pdf"; \\local path
    string targetpath = @"C:\FileTranfer\1800199164.pdf"; \\vm path
    //Your code here 
    //Let's say file copy:
    if (!File.Exists(targetpath))
    {
        File.Copy(SourcePath, targetpath);
    }
});

我收到错误的用户名或密码无效

0 个答案:

没有答案
相关问题