Set or return if a connection to the server is secure.
Syntax
object.Secure [= { True | False } ]
Remarks
The Secure property determines if a secure connection is
established to the server. The default value for this property is
False, which specifies that a standard connection to the server is
used. To establish a secure connection, the application must set this
property value to True prior to calling the Connect method.
Once the connection has been established, the client may request
files or submit queries to the server as with standard
connections.
It is strongly recommended that any application that sets this
property True use error handling to trap an errors that may occur. If
the control is unable to initialize the security libraries, or
otherwise cannot create a secure session for the client, an error
will be generated when this property value is set.
Data Type
Boolean
Example
The following example establishes a secure connection to a server
and retrieves a file:
FtpClient1.HostName = strHostName
FtpClient1.RemotePort = 21
FtpClient1.UserName = strUserName
FtpClient1.Password = strPassword
FtpClient1.Secure = True
nError = FtpClient1.Connect()
If nError > 0 Then
MsgBox "Unable to connect to server " & strHostName, vbExclamation
Exit Sub
End If
If FtpClient1.CertificateStatus <> stCertificateValid Then
nResult = MsgBox("The server certificate could not be validated" & vbCrLf & _
"Are you sure you wish to continue?", vbYesNo)
If nResult = vbNo Then
FtpClient1.Disconnect
Exit Sub
End If
End If
nError = FtpClient1.GetFile(strLocalFile, strRemoteFile)
FtpClient1.Disconnect
If nError > 0 Then
MsgBox "Unable to download " & strRemoteFile, vbExclamation
Exit Sub
End If
See Also
CertificateStatus Property,
Connect Method
|