IMsTscAxEvents::OnDisconnected method

Called when the client control has been disconnected from the Remote Desktop Session Host (RD Session Host) server.


void OnDisconnected(
  [in] long discReason


discReason [in]

Specifies the reason for the disconnection. The following is a list of error codes. Some of these error codes are defined in Wincred.h.

disconnectReasonAtClientWinsockFDCLOSE (2308 (0x904))

Socket closed.

disconnectReasonByServer (3 (0x3))

Remote disconnection by server. This is not an error code.

disconnectReasonClientDecompressionError (3080 (0xC08))

Decompression error.

disconnectReasonConnectionTimedOut (264 (0x108))

Connection timed out.

disconnectReasonDecryptionError (3078 (0xC06))

Decryption error.

disconnectReasonDNSLookupFailed (260 (0x104))

DNS name lookup failure.

disconnectReasonDNSLookupFailed2 (1288 (0x508))

DNS lookup failed.

disconnectReasonEncryptionError (2822 (0xB06))

Encryption error.

disconnectReasonGetHostByNameFailed (1540 (0x604))

Windows Sockets gethostbyname call failed.

disconnectReasonHostNotFound (520 (0x208))

Host not found error.

disconnectReasonInternalError (1032 (0x408))

Internal error.

disconnectReasonInternalSecurityError (2310 (0x906))

Internal security error.

disconnectReasonInternalSecurityError2 (2566 (0xA06))

Internal security error.

disconnectReasonInvalidEncryption (1286 (0x506))

The encryption method specified is not valid.

disconnectReasonInvalidIP (2052 (0x804))

Bad IP address specified.

disconnectReasonInvalidServerSecurityInfo (1542 (0x606))

Server security data is not valid.

disconnectReasonInvalidSecurityData (1030 (0x406))

Security data is not valid.

disconnectReasonInvalidIPAddr (776 (0x308))

The IP address specified is not valid.

disconnectReasonLicensingFailed (2056 (0x808))

License negotiation failed.

disconnectReasonLicensingTimeout (2312 (0x908))

Licensing time-out.

disconnectReasonLocalNotError (1 (0x1))

Local disconnection. This is not an error code.

disconnectReasonNoInfo (0 (0x0))

No information is available.

disconnectReasonOutOfMemory (262 (0x106))

Out of memory.

disconnectReasonOutOfMemory2 (518 (0x206))

Out of memory.

disconnectReasonOutOfMemory3 (774 (0x306))

Out of memory.

disconnectReasonRemoteByUser (2 (0x2))

Remote disconnection by user. This is not an error code.

disconnectReasonServerCertificateUnpackErr (1798 (0x706))

Failed to unpack server certificate.

disconnectReasonSocketConnectFailed (516 (0x204))

Windows Sockets connect failed.

disconnectReasonSocketRecvFailed (1028 (0x404))

Windows Sockets recv call failed.

disconnectReasonTimeoutOccurred (1796 (0x704))

Time-out occurred.

disconnectReasonTimerError (1544 (0x608))

Internal timer error.

disconnectReasonWinsockSendFailed (772 (0x304))

Windows Sockets send call failed.


The account is disabled.


The account is expired.


The account is locked out.


The account is restricted.

SSL_ERR_CERT_EXPIRED (6919 (0x1B07))

The received certificate is expired.


The policy does not support delegation of credentials to the target server.


The server authentication policy does not allow connection requests using saved credentials. The user must enter new credentials.

SSL_ERR_LOGON_FAILURE (2055 (0x807))

Login failed.


No authority could be contacted for authentication. The domain name of the authenticating party could be wrong, the domain could be unreachable, or there might have been a trust relationship failure.

SSL_ERR_NO_SUCH_USER (2567 (0xA07))

The specified user has no account.


The password is expired.


The user password must be changed before logging on for the first time.

SSL_ERR_POLICY_NTLM_ONLY (5895 (0x1707))

Delegation of credentials to the target server is not allowed unless mutual authentication has been achieved.


The smart card is blocked.


An incorrect PIN was presented to the smart card.

Return value

This method does not return a value.


To retrieve a description of the disconnect error, call the GetErrorDescription method and pass it the discReason parameter and the ExtendedDisconnectReason property of the IMsRdpClient interface.

For more information about Remote Desktop Web Connection, see Requirements for Remote Desktop Web Connection.


Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Type library
IMsTscAxEvents is defined as 336d5562-efa8-482e-8cb3-c5c0fc7a7db6

See also