FtpWebRequest.EnableSsl Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets a Boolean that specifies that an SSL connection should be used.

Namespace:   System.Net
Assembly:  System (in System.dll)

Public Property EnableSsl As Boolean

Property Value

Type: System.Boolean

true if control and data transmissions are encrypted; otherwise, false. The default value is false.

Exception Condition

The connection to the FTP server has already been established.


Unless the EnableSsl property is true, all data and commands, including your user name and password information, are sent to the server in clear text. Anyone monitoring network traffic can view your credentials and use them to connect to the server. If you are connecting to an FTP server that requires credentials and supports SSL, you should set EnableSsl to true.

The "AUTH TLS" command is sent to the server to request an encrypted session. If the server does not recognize this command, you receive a WebException exception.

The following code example uses an encrypted connection to download the directory listing from an FTP server.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top