简体   繁体   中英

Remote Desktop Active X Control doesnt connect

I'm trying to write ac# winform that uses the Remote Desktop Active X Control . But I'm failing to connect to my Testserver. (To which I can connect via mstsc and the same username/password)

It seams that the Control is stuck in the Connecting state as this is the only event that fires and the Control remains white.

I've added this control vom the COM Components: Component Selection

My code is:

private void Connect()
    {
        rdpClient.Server = "10.0.0.13";
        rdpClient.UserName = "test";
        rdpClient.AdvancedSettings2.ClearTextPassword = "test";

        rdpClient.OnConnecting += RdpClientOnOnConnecting;
        rdpClient.OnConnected += RdpClientOnOnConnected;
        rdpClient.OnWarning += RdpClientOnOnWarning;
        rdpClient.OnFatalError += RdpClientOnOnFatalError;

        rdpClient.Connect();
    }

Can anyone tell me what I'm doing wrong?

Any help would be greatly appreciated.

PS. I'm using a Windows 10 PC for development if that changes anything

You should also set the property of Credential support . Add this line after setting the clear passowrd

 rdpClient.AdvancedSettings8.EnableCredSspSupport = true;

So your full code should look like this

private void Connect()
{
    rdpClient.Server = "10.0.0.13";
    rdpClient.UserName = "test";
    rdpClient.AdvancedSettings2.ClearTextPassword = "test";
    rdpClient.AdvancedSettings8.EnableCredSspSupport = true;

    rdpClient.OnConnecting += RdpClientOnOnConnecting;
    rdpClient.OnConnected += RdpClientOnOnConnected;
    rdpClient.OnWarning += RdpClientOnOnWarning;
    rdpClient.OnFatalError += RdpClientOnOnFatalError;

    rdpClient.Connect();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM