c# - An error occur while loading from c:\temp.rdp -
i trying open rdp asp.net application. created method create .rdp file connection parameters when tried run method got following error :
an error occur while loading c:\temp.rdp
here's code:
public static void rdctest(string server, string domain, string username, string password) { string encyptedpassword = ""; //calling cryptunprotectdata api encypt password, //read link how this: //http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic21805.aspx 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("full address:s:" + server); sw.writeline("username:s:" + username); sw.writeline("domain:s:" + domain); sw.writeline("password 51:b:" + encyptedpassword); } process rdcprocess = new process(); string strexe = environment.expandenvironmentvariables(@"%systemroot%\system32\mstsc.exe"); rdcprocess.startinfo.filename = strexe; rdcprocess.startinfo.arguments = filename; rdcprocess.start(); } } any idea appreciated!
Comments
Post a Comment