Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Implicit Secure FTP SSL on Port 990VB.NET sample program demonstrating FTP over SSL on port 990. ' This example demonstrates how to do secure FTP uploads and downloads
' using implicit SSL on FTP port 990. This is a less common way of doing secure FTP.
' If the FTP client is behind a network address translating router, such as a typical
' DSL/Cable router, this will not work when the transfer mode is Active, as opposed to Passive.
' The reason is that the router cannot translate the IP address issued in the PORT command
' when setting up the data channel. To do secure FTP behind a router, use "AUTH TLS"
' instead. (refer to http://www.example-code.com/vbdotnet/ftps_auth_tls.asp )
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim ftp As New Chilkat.Ftp2
Dim success As Boolean
success = ftp.UnlockComponent("Anything for 30-day trial")
If (Not success) Then
MessageBox.Show(ftp.LastErrorText)
Exit Sub
End If
' Set the AuthTls property = false.
ftp.AuthTls = False
' Set Ssl = True and the port must be 990:
ftp.Ssl = True
ftp.Port = 990
' Set the FTP hostname, login, and password.
ftp.Hostname = "ftp.myftpserver.com"
ftp.Username = "web0041"
ftp.Password = "****"
' Session logging is not required, but I'm turning it on here to see
' what transpires during the FTP session. The session log provides the
' unencrypted FTP requests and responses.
ftp.KeepSessionLog = True
' Connect and login to the FTP server.
success = ftp.Connect()
If (Not success) Then
MessageBox.Show(ftp.LastErrorText)
Exit Sub
End If
' Upload a file.
Dim localFilename As String
Dim remoteFilename As String
localFilename = "hamlet.xml"
remoteFilename = "hamlet.xml"
success = ftp.PutFile(localFilename, remoteFilename)
If (Not success) Then
MessageBox.Show(ftp.LastErrorText)
Exit Sub
End If
' You may examine the LastErrorText even when successful
' to review the details of the file transfer. You can verify
' that the file was transferred over a secure channel:
MessageBox.Show(ftp.LastErrorText)
' Download a file.
localFilename = "hamletDownloaded.xml"
success = ftp.GetFile(remoteFilename, localFilename)
If (Not success) Then
MessageBox.Show(ftp.LastErrorText)
Exit Sub
End If
' Disconnect
ftp.Disconnect()
' Display the session log
TextBox1.Text = ftp.SessionLog
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.