Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

nishit.2571988@gmail.com

issue resolve

issue resolve by using generateurl code
thanks
martin

Re: Need example of .NET Core 2.0 using FTP

You have a code for .NET Core 2.0 using FTP. If it does no work, we need full session log file showing the problem (using the latest version of WinSCP).

Also, can you login anyhow? Like using WinSCP GUI? If you can, post its log file too. Or have the GUI generate working code for you:
https://winscp.net/eng/docs/ui_generateurl#code

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
nishit.2571988@gmail.com

Need example of .NET Core 2.0 using FTP

I have tried with below code with FTP but not work got error like require authentication before user command. I have use WinSCP nuget package latest version in ASP.NET Core 2.0.
Can you please share me one example of ASP.NET Core 2.0 using FTP not SFTP.
var sessionOptions = new SessionOptions
{
    Protocol = Protocol.Ftp,
    HostName = "ftp.hostname.com",
    PortNumber = 21,
    UserName = "ABC@ftp.hostname.com",
    Password = "Test12"
};
try
{
    using (var session = new Session())
    {
        session.Open(sessionOptions);
 
        var transferOptions = new TransferOptions
        {
            TransferMode = TransferMode.Binary
        };
 
        var transferResult = session.GetFiles("/test-destination/*.*",@"C:\test\",
            false, transferOptions);
 
        transferResult.Check();
 
        foreach (TransferEventArgs transfer in transferResult.Transfers)
        {
            Console.WriteLine("Uploaded file: " + transfer.FileName);
        }
    }
 
}
catch (Exception ex)
{
    return false;
}