Canceling File Transfer While Transferring a File to a Destination

I used Winscp to transfer files and got the file transfer details as below,

Mandatory file transfer data continuously until file is transferred to window using WPF

and the code transfer link below

https://winscp.net/eng/docs/library

But I need to cancel the file transfer. Please give your suggestion.

+3


source to share


2 answers


From what I understand, the only way to achieve this is to abort the current session.



link: https://winscp.net/eng/docs/library_session_abort

+2


source


With WinSCP 5.10 beta, you can use FileTransferProgressEventArgs.Cancel

:



bool cancel = false; // set to true to cancel the transfer

session.FileTransferProgress +=
    (sender, e) =>
    {
        if (cancel)
        {
            e.Cancel = true;
        }
    };

session.PutFiles(localPath, remotePath).Check();

      

0


source







All Articles