1

我在我的 WinForms 应用程序中托管 IMsRdpClient6 ActiveX 控件,以便与远程计算机建立连接。

我已经设置了一个终端服务网关机器,我可以成功使用它。

我想让我的 ActiveX 控件使用这个网关。我已经设置了网关选项,但连接失败,我看不到任何错误。这是我正在使用的代码:

        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";
            }
        }
4

3 回答 3

0

答案是省略 GatewayUserSelectedCredsSource 并包含 GatewayProfileUsageMethod = 1;

        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 = 1;

                client6.TransportSettings.GatewayCredsSource = 0;
                client6.TransportSettings.GatewayProfileUsageMethod = 1;
                client6.TransportSettings2.GatewayDomain = "mydomain";
                client6.TransportSettings2.GatewayPassword = "mypassword";
                client6.TransportSettings2.GatewayUsername = "myusername";
            }
        }
于 2009-07-01T19:43:27.200 回答
0

可以通过嵌入在网页上的 ActiveX 来做到这一点吗?

于 2009-07-17T22:57:08.230 回答
0

刚刚尝试添加此代码并得到一个字段无效错误。我猜这与未设置服务器名称有关,但在您的示例中未设置。你能解释一下如何解决这个问题。

问候安德鲁。如果需要,将发布代码。

于 2009-07-24T02:40:11.523 回答