Topic "Copying files to remote side failed, Could not change to "/ftp:/"; 'ftp:' not found"

Author Message
dyankovich
[View user's profile]

Joined: 2015-08-03
Posts: 1
I continually get this error on the line of code noted below what could I be doing wrong? thank you all for everything!!!

{WinSCP.SessionRemoteException: Error transferring file '@"C:file\filename.txt"'. ---> WinSCP.SessionRemoteException: Copying files to remote side failed.
Could not change to "/ftp:/"; 'ftp:' not found.
--- End of inner exception stack trace ---
at WinSCP.OperationResultBase.Check()



<appSettings>
<add key="FTPUrl" value="ftp://host.com/folder%20-%to%20uploadto/"/>
<add key="FTPUser" value="domain/username"/>
<add key="FTPPass" value="password"/>
<add key="FTPDomain" value="domain"/>
</appSettings>

private static void transferWinSCP()
{
string userName = ConfigurationManager.AppSettings["FTPUser"];
string password = ConfigurationManager.AppSettings["FTPPass"];
string url = ConfigurationManager.AppSettings["FTPUrl"];
try
{
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Ftp,
HostName = "hostname.com",
PortNumber = 990,
UserName = userName,
Password = password,
FtpSecure = FtpSecure.Implicit,
FtpMode = FtpMode.Passive,
TlsHostCertificateFingerprint = "xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
};

using (Session session = new Session())
{
//connect
session.Open(sessionOptions);

//upload
TransferOptions transferOptions = new TransferOptions {TransferMode = TransferMode.Binary};

TransferOperationResult transferResult = session.PutFiles(@"C:file\filename.txt",url, false,
transferOptions);
I get the error on this line

transferResult.Check(); //ftp error

foreach (TransferEventArgs transfer in transferResult.Transfers)
{
Console.Write("upload of {0} succeeded", transfer.FileName);
}


}

}
catch (Exception ex)
{
Console.Write("error {0}", ex);
}
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Your duplicate post on Stack Overflow:
http://stackoverflow.com/questions/31818175/winscp-sessionremoteexception-copying-files-to-remote-side-failed-could-not-ch
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License