smtsc form C# code
<p>I tried the below code and it works well but what i want now is to pass password and disable the pop up message which raised when open the rdp connection.everytime i tried to uncomment the line : <code>sw.WriteLine("password 51:b:" + password);
</code> an error occur saying that "An error can not downloading file c:\temp.rdp"</p>

<pre><code>  public static void RdcTest(String server,String UserName,String password)
    {  

        string filename = @"c:\temp.rdp";

        if (!File.Exists(filename))
        {

            using (FileStream fs = File.Create(filename))

            using (StreamWriter sw = new StreamWriter(fs))
            {

                sw.WriteLine("screen mode id:i:2");
                sw.WriteLine("desktopwidth:i:1440");
                sw.WriteLine("desktopheight:i:900");
                sw.WriteLine("session bpp:i:32");
                sw.WriteLine("winposstr:s:0,1,4,12,1440,864");
                sw.WriteLine("compression:i:1");
                sw.WriteLine("keyboardhook:i:2");
                sw.WriteLine("displayconnectionbar:i:1");
                sw.WriteLine("disable wallpaper:i:1");
                sw.WriteLine("disable full window drag:i:1");
                sw.WriteLine("allow desktop composition:i:0");
                sw.WriteLine("allow font smoothing:i:0");
                sw.WriteLine("disable menu anims:i:1");
                sw.WriteLine("disable themes:i:0");
                sw.WriteLine("disable cursor setting:i:0");
                sw.WriteLine("bitmapcachepersistenable:i:1");
                sw.WriteLine("full address:s:" + server);
                sw.WriteLine("username:s:" + UserName);
                //sw.WriteLine("password 51:b:" + password);
                sw.WriteLine("audiomode:i:0");
                sw.WriteLine("redirectprinters:i:1");
                sw.WriteLine("redirectcomports:i:0");
                sw.WriteLine("redirectsmartcards:i:1");
                sw.WriteLine("redirectclipboard:i:1");
                sw.WriteLine("redirectposdevices:i:0");
                sw.WriteLine("autoreconnection enabled:i:1");
                sw.WriteLine("authentication level:i:0");
                sw.WriteLine("prompt for credentials:i:0");
                sw.WriteLine("negotiate security layer:i:1");
                sw.WriteLine("remoteapplicationmode:i:0");

                //sw.WriteLine("domain:s:" + domain);

            }

            Process rdcProcess = new Process();

            string strExE = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");

            rdcProcess.StartInfo.FileName = strExE;

            rdcProcess.StartInfo.Arguments = filename;

            rdcProcess.Start();

        }

    }
</code></pre>

<p>any help?</p>
