AxMsRdpClient9 Dismiss login dialog

烂漫一生 提交于 2020-01-16 19:19:26

问题


I am writing rdp client using c#. Simple example:

        AxMsRdpClient9NotSafeForScripting c = new AxMsRdpClient9NotSafeForScripting();
        Form1.Controls.Add(c);
        c.Server = s.ip;
        c.UserName = s.pass;
        c.AdvancedSettings9.ClearTextPassword = s.pass;
        c.Connect();

So, when I try to connect to Win7 or less it works perfect, but when I try to connect to Win Server 2012, rdpclient doesn't connect and doesn't return any errors. Connecting to win server works when I use this option:

c.AdvancedSettings9.EnableCredSspSupport = true;

but with this option, when I try to connect to win server with invalid credentials it shows dialog with login\pass fields, that I can't dissmiss programmatically, I have to do it "by hand". So question is: how can I connect to win server without

c.AdvancedSettings9.EnableCredSspSupport = true;

or how can I dissmiss login\pass dialog in code?


回答1:


The solution is to set AllowPromptingForCredentials to false.




回答2:


Here are the additional details to finish @davyjohnes answer:

....
Form1.Controls.Add(c);
var ocx = c.GetOcx() as MSTSCLib.IMsRdpClientNonScriptable5;
ocx.AllowPromptingForCredentials = false;
c.Server = s.ip;
....


来源:https://stackoverflow.com/questions/22759207/axmsrdpclient9-dismiss-login-dialog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!