Sketched this code, but for some reason it does not display the result, although if I am connected via RDP to the server and connect to it through this program, it throws me out but in the program it displays an error:

using System; using System.Threading; using MSTSCLib; namespace test { class Program { static void Main(string[] args) { try { var rdp = new MSTSCLib.MsRdpClient8(); rdp.Server = "6.6.16.6";// host.Text; rdp.UserName = "admin"; // login.Text; rdp.AdvancedSettings2.ClearTextPassword = "admin"; rdp.AdvancedSettings7.EnableCredSspSupport = true; rdp.Connect(); if (rdp.Connected.ToString() == "1" ) { rdp.Disconnect(); Console.WriteLine("good"); Console.ReadKey(); } else { Console.WriteLine("error"); Console.ReadKey(); } } catch (Exception) { // Console.ReadKey(); } } } } 
  • Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky
  • and what is not clear here? when you run this code, he writes error in the console, although the active connection of the RDP breaks - Joe Ming
  • Which of the 2 remaining possible values ​​returns Connected ? - rdorn
  • Found a more detailed connection option, maybe there is something that you did not take into account software-testing.ru/forum/index.php?/topic/… - rdorn
  • And the last question, why are you trying to connect in this way to RDP? Perhaps, if of course you describe the task you are trying to solve, there is a simpler solution. - rdorn

0