Hi, I am using your trial software but having an issue connecting SFTP. I can use FileZilla to validate the connection, can I provide the SFTP param info and ASPOSE duplicate?
Hi,
Thank you for inquiry.
Please try the following code.
string host = “host”;
int port = 22; // the default port
AuthenticationInfo authenticationInfo = new AuthenticationInfo();
authenticationInfo.UserName = “ftpuser”;
authenticationInfo.Password = “pwd”;
if (publicKey == true)
{
Console.Write("\nEnter path to file containing publickey: ");
string path = “ssh.key”;
if (File.Exists(path))
authenticationInfo.LoadPrivateKey(path);
else
{
Console.WriteLine(“The specified file doesn’t exist. Publickey authentication will be disabled”);
}
}
// connecting to the server
SftpClient client = new SftpClient();
try
{
client.Connect(host, port, authenticationInfo);
Console.WriteLine(“Successfully connected”);
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
}
If it does not work, please provide the parameters of FileZilla and Aspose that you used.int port = 22; // the default port
AuthenticationInfo authenticationInfo = new AuthenticationInfo();
authenticationInfo.UserName = “ftpuser”;
authenticationInfo.Password = “pwd”;
if (publicKey == true)
{
Console.Write("\nEnter path to file containing publickey: ");
string path = “ssh.key”;
if (File.Exists(path))
authenticationInfo.LoadPrivateKey(path);
else
{
Console.WriteLine(“The specified file doesn’t exist. Publickey authentication will be disabled”);
}
}
// connecting to the server
SftpClient client = new SftpClient();
try
{
client.Connect(host, port, authenticationInfo);
Console.WriteLine(“Successfully connected”);
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
}
Thank you that worked out fine.