Tuesday, May 11, 2010

coding for connectoin remote desktop using c#

Process process_conectoin = new Process();
string exe = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");
if (exe != null)
{
process_conectoin.StartInfo.FileName = exe;
process_conectoin.StartInfo.Arguments = "/v " + "192.168.1.2"; // ip or name of computer to connect
process_conectoin.Start();
}

 This is another way to run Remote desktop using c#.net

Steps for creating .RDP File for running remote connection from ur code.

step 1: Enter machine name,user name,password,domain name and check save password then click saveas button to save the RDP file in ur root folder.




 Step 2:the write the code given below.

  using System.Diagnostics;

        Process.Start(Server.MapPath("Filename.rdp"));

No comments: