0

I'm trying to start a Remote Desktop (Client) session from inside a UWP C# app like this:

Uri mstscUri = new Uri(@"rdp://full%20address=s:<ip_address>");
await Launcher.LaunchUriAsync(mstscUri);

I keep receiving an error:

System.UriFormatException: 'Invalid URI: The hostname could not be parsed.'

If I use the same URI and simply type it into a "run" dialog, I am prompted to download an app from the Windows Store to handle the "rdp" URI.

How can I make this work in my app?

Daniel Goudie
  • 75
  • 2
  • 6
  • The URI need to be handled when your computer already registered it as the default protocol. If you want to use rdp://full address:s:xx.xx.xx.xx, you have to make sure that this protocol can be known by your system first. Can you make sure that you've installed rdp related components on your OS so it can handle the protocol when your type it in 'run" or "file explorer"? – Barry Wang Feb 16 '18 at 02:33
  • By the way, to check the default protocol. You can check from settings->default apps->choose default apps by protocol, if a uri is listed there, then you will be able to use launchuri async to launch it. – Barry Wang Feb 16 '18 at 02:35
  • Barry - Thanks for pointing out this menu, but after looking here, I don't see anything related to "RDP" or "Remote Desktop". Is there a way for me to add one? – Daniel Goudie Feb 16 '18 at 23:48

2 Answers2

0

I don't know Laucher.LaunchUriAsync, but im guessing it will run the URI as a web uri. You might want to run it as a command, try looking at this.

Muzib
  • 2,412
  • 3
  • 21
  • 32
Martin M
  • 463
  • 8
  • 20
0

Checked about your issue again and it seems Windows 10 by default does not support this URI scheme to be called from itself. The RDP URI scheme article says it works for Windows 10 but it seems it only means that you can call them from iOS,Android and MAC, not saying that you can call this protocol from Windows 10 PC. For PC you may need some other ways, like register the protocol yourself for the specific PC or use some third party tools.

Barry Wang
  • 1,459
  • 1
  • 8
  • 12