First, you don’t need an extra component to do the operations listed in the pho3nix
, it is possible to do everything with the . "pure" NET, even more a simple operation like the one you want. What’s more, the package Ftp.dll
is paid, maybe you haven’t noticed this, but just enter their site that you can see the following message.
This download is Fully Functional trial. It has the same Features as the Registered version. The Evaluation version of the Component displays "Please Purchase a License" dialog. Some uploaded files will have their name changed. To remove this limitation you’ll need to Purchase a License.
Second, the answer is wrong, at least according to the description of your question. SFTP and FTPS are two things completely different. Briefly:
FTPS is the FTP protocol with the addition of SSL, for security.
SFTP (SSH File Transfer Protocol/Secure File Transfer Protocol) is an extension of SSH that provides file transfer capability.
In this case, you will even need an extra package to assist. I found the SSH.NET, It has not been touched for a long time, but it is open source and it is possible to make the most of it. I tested it using my server and it worked well, here’s an example of how to do
using (var sftp = new SftpClient(servidor, porta, usuario, senha))
{
sftp.Connect();
DateTime data = sftp.GetLastWriteTime("caminhoDoArquivoNoServidor");
sftp.Disconnect();
}
Maybe you’ll be interesting search for some package in nuget
I tried to use this code but it gives exception with error
O nome solicitado é válido, mas não foram encontrados dados do tipo solicitado
on the lineclient.Connect("ftp.example.org")
, you know what can be ?– Lucas Sousa
This may be a stupid question but you have switched from ftp.example.org to your ftp?
– pho3nix
I switched yes, I put my ftp and even saw that the method
Connect
has one of the parameters to put the port and I put the port to access my ftp– Lucas Sousa
I’m sorry about the question, but it happens all the time. Actually I think you have to use Connectssl ( //or Connectssl for SSL) because it is an SFTP
– pho3nix
No problem. So... even though it didn’t work, it gave the same error I used Connectssl and it didn’t work, I even tried to use Beginconnect() but tbm didn’t work.
– Lucas Sousa
I just tested on my pc and with my ftp this ok.
– pho3nix
I think it is valid to remember that this component is paid for. And also that it is possible to do this without it, which your answer does not explain.
– Randrade