动态生成RDP文件

时间:2009-11-19 09:40:30

标签: remote-desktop terminal-services rdp

我想创建一个类似于TS Web Access的Web应用程序,我可以在其中为服务器上配置的远程应用程序动态创建rdp文件。有什么想法??

2 个答案:

答案 0 :(得分:2)

我们必须做到这一点。

private void InvokeRDPSign(String fileName, String certificateThumbPrint)
{
    Process signingProcess = new Process();
    signingProcess.StartInfo.FileName = @"rdpsign.exe";

    String arguments = String.Format("/sha1 {0} {1}", certificateThumbPrint, fileName);
    signingProcess.StartInfo.Arguments = arguments;
    signingProcess.StartInfo.UseShellExecute = false;
    signingProcess.StartInfo.RedirectStandardOutput = true;
    signingProcess.StartInfo.WorkingDirectory = Environment.SystemDirectory;
    signingProcess.Start();

    String signingOutput = signingProcess.StandardOutput.ReadToEnd();
    signingProcess.WaitForExit();
    int exitCode = signingProcess.ExitCode;
    //TODO:  should we throw an error if the exitcode is not 0

}

请注意,每个版本的Windows上的RDPSign.exe都不同。您会发现该实用程序的旧版本将忽略签名中较新的设置。

答案 1 :(得分:1)

好了看了'rdp'文件,这就是内容:

screen mode id:i:2
desktopwidth:i:1280
desktopheight:i:768
session bpp:i:32
winposstr:s:2,3,1430,104,2230,704
compression:i:1
keyboardhook:i:2
displayconnectionbar:i:1
disable wallpaper:i:1
disable full window drag:i:1
allow desktop composition:i:0
allow font smoothing:i:0
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s: [YOUR IP]
audiomode:i:0
redirectprinters:i:1
redirectcomports:i:0
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
autoreconnection enabled:i:1
authentication level:i:0
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:
shell working directory:s:
gatewayhostname:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
drivestoredirect:s:

只需将其创建为字符串,看起来很简单。

ps我不知道'winposstr'参数是什么......