I am hosting the IMsRdpClient6 ActiveX control in my WinForms application in order to make connections to remote machines.
I have setup a terminal services gateway machine, and I can successfully use it.
I want to get my ActiveX control to use this gateway. I have set the Gateway options, but connection fails with no error that I can see. Here is the code that I am using:
MSTSCLib6.IMsRdpClient6 client6 = RdpClient.GetOcx() as MSTSCLib6.IMsRdpClient6;
if (client6 != null)
{
MSTSCLib6.IMsRdpClientTransportSettings2 transport = client6.TransportSettings2;
if (Convert.ToBoolean(transport.GatewayIsSupported) == true)
{
client6.TransportSettings.GatewayHostname = "mygateway";
client6.TransportSettings.GatewayUsageMethod = 2;
client6.TransportSettings.GatewayCredsSource = 0;
client6.TransportSettings.GatewayUserSelectedCredsSource = 0;
client6.TransportSettings2.GatewayDomain = "mydomain";
client6.TransportSettings2.GatewayPassword = "mypassword";
client6.TransportSettings2.GatewayUsername = "myusername";
}
}