Defines information to allow an automatic connection and authentication of the session. Is used with Session.Open method.
Namespace: WinSCP
| C# | public sealed class SessionOptions |
| VB.NET | Public NotInheritable Class SessionOptions |
| Name | Description |
|---|---|
| SessionOptions() | Default constructor. |
| Name | Description |
|---|---|
| FtpMode FtpMode | FTP mode. Possible values are FtpMode.Passive (default) and FtpMode.Active. |
| FtpSecure FtpSecure | FTPS mode. Possible values are FtpSecure.None (default), FtpSecure.Implicit, FtpSecure.ExplicitSsl and FtpSecure.ExplicitTls. |
| bool GiveUpSecurityAndAcceptAnySshHostKey | Give up security and accept any SSH host key. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. To maintain security, use SshHostKeyFingerprint. |
| bool GiveUpSecurityAndAcceptAnySslHostCertificate | Give up security and accept any FTPS server SSL/TLS certificate. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. To maintain security, use SslHostCertificateFingerprint. |
| string HostName | Name of the host to connect to. Mandatory property. |
| string Password | Password for authentication. |
| int PortNumber | Port number to connect to. Keep default 0 to use the default port for the protocol. |
| Protocol Protocol | Protocol to use for the session. Possible values are Protocol.Sftp (default), Protocol.Scp and Protocol.Ftp. |
| string SshHostKeyFingerprint | Fingerprint of SSH server host key (or several alternative fingerprints separated by semicolon). It makes WinSCP automatically accept hostkey with the fingerprint. Mandatory for SFTP/SCP protocol.1) Learn how to obtain host key fingerprint. |
| string SshPrivateKeyPath | Full path to private key file. The key has to be passphrase-less or Pageant has to be running with the key loaded (SshPrivateKeyPath then serves only to select, what private key Pageant should use, in case more keys are loaded). |
| string SslHostCertificateFingerprint | Fingerprint of FTPS server SSL/TLS certificate to be automatically accepted (useful for certificates signed by untrusted authority). |
| TimeSpan Timeout | Server response timeout. Defaults to 15 seconds. |
| string UserName | Username for authentication. Mandatory property. |
| Name | Description |
|---|---|
| void AddRawSettings(string setting, string value) | Allows configuring any session settings using raw format as in an INI file. E.g. to enable SSH compression and agent forwarding use AddRawSettings("Compression", "1") and AddRawSettings("AgentFwd", "1"). |
You need to fill in all properties required to connect and authenticate your session automatically.
You always need to fill in Protocol, HostName and UserName2).
In most cases you need to fill in Password. Exceptions are:
For SSH (SFTP/SCP) session you need to fill in the SshHostKeyFingerprint to verify the expected server host key.
null, if you set GiveUpSecurityAndAcceptAnySshHostKey; or if you set Session.DefaultConfiguration to false and make sure the host key is already accepted in the configuration, only (not recommended).
Site design by Black Gate