I'm trying to check my RDP credentials using c#
Here is my reference : Remote Desktop using C#.NET
And here is what I've done so far :
private void testBtn_Click(object sender, EventArgs e) {
try {
AxMsRdpClient8NotSafeForScripting ax = new AxMsRdpClient8NotSafeForScripting();
ax.OnLoginComplete += Ax_OnLoginComplete;
ax.OnLogonError += Ax_OnLogonError;
ax.OnFatalError += Ax_OnFatalError;
ax.Size = new Size(1, 1);
ax.CreateControl();
ax.Server = ipTbx.Text;
ax.UserName = userNameTbx.Text;
MsRdpClient8NotSafeForScripting sec = (MsRdpClient8NotSafeForScripting)ax.GetOcx();
sec.AdvancedSettings8.ClearTextPassword = passwordTbx.Text;
sec.AdvancedSettings8.EnableCredSspSupport = true;
ax.Connect();
} catch (Exception ex) {
MessageBox.Show("Error : " + ex.Message);
}
}
private void Ax_OnFatalError(object sender, IMsTscAxEvents_OnFatalErrorEvent e) {
SaySomething();
}
private void Ax_OnLogonError(object sender, IMsTscAxEvents_OnLogonErrorEvent e) {
SaySomething();
}
private void Ax_OnLoginComplete(object sender, EventArgs e) {
SaySomething();
}
public void SaySomething() {
MessageBox.Show("Worked!");
}
As you can see, I've done everything in the article way. But nothing happens, even an exception would be worthy.
Any Idea?