C# SFTP No Such File
<p>I'm using the <a href="http://sshnet.codeplex.com/" rel="noreferrer">SSH.NET library</a> to connect to a remote SFTP server. I'm trying to use very basic code but it's not working</p>

<pre><code>using (var client = new SftpClient(host, username, password))
{
    client.Connect();   
    client.ChangeDirectory(@"sftp://server.example.com/other_directory");
}
</code></pre>

<p>However, this throws an exception saying <code>No Such File</code> on the <code>ChangeDirectory</code> method.</p>

<p>I tried the same with Curl but got an error saying</p>

<blockquote>
  <p>curl: (51) SSL peer certificate or SSH remote key was not OK</p>
</blockquote>

<p>However, I added curl's <a href="https://curl.haxx.se/docs/sslcerts.html" rel="noreferrer">--insecure</a> argument and everything worked fine.</p>

<p>Could the <code>--insecure</code> part be related to why the <code>SSH.NET</code> library isn't working or is there another reason? Is there a way to simulate what <code>--insecure</code> does in C#?</p>

<p>Thanks</p>