Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: SSH.net server string is null by sftp.connect()

$
0
0
Hi,

First of all I want to say that so far I have no experience with the ssh.net Framework.
I want to connect to the server but the following problem (server string is null at line sftp.Connect();) occured and I'm not able to solve it.
Maybe someone can tell me what it could be or what i should check.

Thanks in advance
using (var sftp = new SftpClient("127.0.0.1", 990, "admin", "admin"))
                {

                    string wd=sftp.WorkingDirectory;
                    string ci = sftp.ConnectionInfo.ToString();
    

                   if(!sftp.IsConnected)
                    sftp.Connect();

                    string uploadedFileName = @"C:\Users\gat\Desktop\test\MyFile.txt";
                    string remoteFileName = "test2.txt";

              
                    using (var file = File.OpenRead(uploadedFileName))
                    {
                        sftp.UploadFile(file, remoteFileName);
                    }

                    sftp.Disconnect();
                }
}

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>