I'm trying to open an rdp session to a server from my web page.
<td><a href="file:///c:/Users/stegar06/Desktop/wtf.bat">testrdp</a></td>
The .bat file just has the following line written in it: mstsc /v:emea-cirrus
What happens is that the file just gets displayed in my chrome browser as a text file. So the web page just loads and literally says "mstsc /v:emea-cirrus" at the top. How can I get it to launch the remote desktop client and go to the address?
I have also tried making a .rdp file and referencing that is the href, which also just showed up as plain text. The RDP file was created using the following code:
screen mode id:i:2
desktopwidth:i:1436
desktopheight:i:925
session bpp:i:16
auto connect:i:1
full address:s:emea-orion
compression:i:1
keyboardhook:i:2
audiomode:i:2
redirectdrives:i:0
redirectprinters:i:0
redirectcomports:i:0
redirectsmartcards:i:0
displayconnectionbar:i:1
alternate shell:s:
shell working directory:s:
disable wallpaper:i:1
disable full window drag:i:1
disable menu anims:i:1
disable themes:i:1
bitmapcachepersistenable:i:1
winposstr:s:0,3,0,0,800,600
redirectclipboard:i:1
redirectposdevices:i:0
drivestoredirect:s:
autoreconnection enabled:i:1
authentication level:i:0
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
allow desktop composition:i:0
allow font smoothing:i:0
disable cursor setting:i:0
gatewayhostname:s:
gatewayusagemethod:i:0
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
You can create the .RDP file on the server side, which Windows should associate with Remote Desktop, and force the browser to download it (instead of displaying it). In PHP you would do it like this:
$file = 'screen mode id:i:2
desktopwidth:i:1436
desktopheight:i:925
session bpp:i:16
auto connect:i:1
full address:s:emea-orion
compression:i:1
keyboardhook:i:2
audiomode:i:2
redirectdrives:i:0
redirectprinters:i:0
redirectcomports:i:0
redirectsmartcards:i:0
displayconnectionbar:i:1
alternate shell:s:
shell working directory:s:
disable wallpaper:i:1
disable full window drag:i:1
disable menu anims:i:1
disable themes:i:1
bitmapcachepersistenable:i:1
winposstr:s:0,3,0,0,800,600
redirectclipboard:i:1
redirectposdevices:i:0
drivestoredirect:s:
autoreconnection enabled:i:1
authentication level:i:0
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
allow desktop composition:i:0
allow font smoothing:i:0
disable cursor setting:i:0
gatewayhostname:s:
gatewayusagemethod:i:0
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0';
header("Content-Disposition: attachment; filename=filename.rdp");
header("Content-Type: application/rdp");
print $file;
exit();
I've used this technique before and it has worked well. The user will click the link, be prompted to save or open, and if they click open Remote Desktop will launch with the settings specified.
Example for .NET in particular ASP.MVC
public FileResult RDP() {
MemoryStream memoryStream = new MemoryStream();
TextWriter tw = new StreamWriter(memoryStream);
tw.WriteLine("screen mode id:i:2");
tw.WriteLine("use multimon:i:0");
///The rest of the file
memoryStream.Position = 0;
return File(memoryStream, "application/rdp", "conenction.rdp");
}