我需要一个为我的RDP客户端应用程序设置用户名和密码验证的解决方案。目标是在凭据(用户名或密码)不正确时关闭连接。
当其中一个凭据不正确时,我如何以编程方式验证会话?
try
{
rdp.Server = txtServer.Text;
rdp.UserName = txtUserName.Text;
IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
secured.ClearTextPassword = txtPassword.Text;
rdp.OnLoginComplete += RdpOnOnLoginComplete;
rdp.OnLogonError += rdp_OnLogonError;
rdp.Connect();
}
catch (Exception Ex)
{
MessageBox.Show("Error Connecting", "Error connecting to remote desktop " + txtServer.Text + " Error: " + Ex.Message,MessageBoxButtons.OK, MessageBoxIcon.Error);
}事件
void rdp_OnLogonError(object sender, AxMSTSCLib.IMsTscAxEvents_OnLogonErrorEvent e)
{
throw new NotImplementedException();
}
private void RdpOnOnLoginComplete(object sender, EventArgs eventArgs)
{
throw new NotImplementedException();
}发布于 2014-11-29 08:03:19
但重要的是,当使用旧的TSAC控件或新的RDPC控件连接到Server2008 R2 (包括Windows Home Server2011)时,该控件似乎不提供任何“登录失败”反馈。我认为这是一种安全措施,旨在帮助防止使用这些控件进行黑客攻击和破解。
与独立的RDP客户端实用程序不同,登录失败会导致连接被保留,使用户只能查看远程系统的登录桌面。这允许用户手动登录,但会阻止程序获得登录失败的反馈并尝试另一个用户/密码。
所以..。如果您的服务器都早于Server2008RDP,您可能仍然会使用这些控件中的一种或另一种来尝试R2连接和登录,并在凭据错误时报告失败。
https://stackoverflow.com/questions/27187709
复制相似问题