动态生成RDP文件

6

我想创建一个类似于TS Web Access的Web应用程序,可以即时创建远程应用程序的rdp文件,并在服务器上进行配置。有什么建议吗?

2个回答

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
}

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


我必须使用提升的帐户作为应用程序池身份验证来使其工作。正如其他帖子所建议的那样,我可能会将此代码移动到具有提升权限的机器上的服务,而不是永久更改应用程序池标识。 - Jason

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:

只需将其创建为字符串,似乎很简单。

附言:我不知道“winposstr”参数是什么...


这完全没问题,但我的远程应用程序是用证书数字签名的,这将在我的rdp文件中添加2个附加参数:
  1. signscope:s
  2. signature:s
我该如何为这些参数创建值,这些值使用SHA1哈希...???
- Gaurav Arya
signscope:s:完整地址,服务器端口,网关主机名,网关使用方法,网关配置文件使用方法,网关凭据来源,提示凭据一次,备用 Shell,远程应用程序程序,远程应用程序模式,远程应用程序名称,远程应用程序命令行,身份验证级别,重定向驱动器,重定向打印机,重定向 COM 端口,重定向智能卡,重定向 POS 设备,重定向剪贴板,要重定向的设备,要重定向的驱动器。 - Gaurav Arya
signature:s:AQABAAEAAACVBAAAMIIEkQYJKoZIhvcNAQcCoIIEgjCCBH4CAQExCzAJBgUrDgMC GgUAMAsGCSqGSIb3DQEHAaCCAvowggL2MIIB3qADAgECAhCMel1Y/5YAjUXCeMhU Fzi8MA0GCSqGSIb3DQEBBQUAMCQxIjAgBgNVBAMTGWx1dHJvbnRzMS5nZ24ubmFn YXJyby5jb20wHhcNMDkxMTE5MDc0NTIyWhcNMTAxMTE4MDAwMDAwWjAkMSIwIAYD VQQDExlsdXRyb250czEuZ2duLm5hZ2Fycm8uY29tMIIBIjANBgkqhkiG9w0BAQEF AAOCAQ8AMIIBCgKCAQEAn+ExkAWD10vOi0TDOyZl9XGuh6Q7qSKVTzaumgUx1S88 H3KS8wLgO6eWThGKaFzLhPhO98G6RRbtxcdcSjeP+3RSQPNA8chbYZ5I3zhPQ8J3 D1d7fvdgWodL+ltvrnTMr0cxZWGR5xtCljwqcKhoUDHnPJQiU9g2WGhs7PqmPOFA - Gaurav Arya
winposstr 可能是客户端窗口的位置和大小(左上角点、右下角点、宽度和高度)。 - Thomas Bratt
看起来是这样的:http://tiredblogger.wordpress.com/2008/11/05/changing-where-rdp-windows-open-on-the-screen/ - Thomas Bratt
显示剩余5条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接