Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

C# Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(C#) Using the FTP Session Log

The Chilkat FTP component can keep a session log if the KeepSessionLog property is turned on. This is helpful in debugging problems. Chilkat support will usually ask for a session log when working to resolve your problem, because it contains a log of the exact commands sent to the FTP server, and the exact responses received.

Chilkat .NET Downloads

Chilkat .NET Assemblies

Chilkat for .NET Core

Chilkat for Mono

Chilkat.Ftp2 ftp = new Chilkat.Ftp2();

bool success;

//  Any string unlocks the component for the 1st 30-days.
success = ftp.UnlockComponent("Anything for 30-day trial");
if (success != true) {
    Console.WriteLine(ftp.LastErrorText);
    return;
}

ftp.Hostname = "www.example-code.com";
ftp.Username = "example-code.com";
ftp.Password = "****";

//  Set the KeepSessionLog property in order to keep a session log.
//  The session log will continuously grow in memory.  The
//  ClearSessionLog method may be called to clear it.  The session
//  logging may be turned on/off at any point.
ftp.KeepSessionLog = true;

//  Connect and login to the FTP server.
success = ftp.Connect();
if (success != true) {
    Console.WriteLine(ftp.LastErrorText);
    return;
}

//  Change to the remote directory where the existing file is located.
success = ftp.ChangeRemoteDir("junk");
if (success != true) {
    Console.WriteLine(ftp.LastErrorText);
    return;
}

//  To clear the SessionLog at any point, call ClearSessionLog:
//  call ftp.ClearSessionLog();

//  Append moreHamlet.txt to hamlet.txt on the FTP server.
string localFilename = "moreHamlet.txt";
string remoteFilename = "hamlet.txt";

success = ftp.AppendFile(localFilename,remoteFilename);
if (success != true) {
    Console.WriteLine(ftp.LastErrorText);
    return;
}

success = ftp.Disconnect();

//  Display the entire session log:
Console.WriteLine(ftp.SessionLog);

Console.WriteLine("File Appended!");

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.