My wpf-application registers its own custom protocol as descripted here:

The other requirment I have, is that every user should be able to choose, if he/she likes to use my application as XBAP (from a webserver) or an installed WinExe.

The registry value under HKEY_CLASSES_ROOT\myapp\shell\open\command looks like:

cmd.exe /c "start http://myserver/myapp.xbap Parameter=%1"

Now I stepped on a big problem, if the user wants to start the XBAP version using the custom protocol.

I'm trying to start the xbap like this: myapp://cmdline/ Key1=Value1&Key2=Value2.

The problem is that everything behind the first "&" is cutted of.

So the result for this call looks like: http://myserver/myapp.xbap Parameter=myapp://cmdline/ Key1=Value1

So what I want to know is, if there is a solution, that external callers, which would like to use the custom protocol, DON'T have to encode the call string.

This is an urgent problem for me, so if someone knows a solution, please let me know.



Re: Windows Presentation Foundation (WPF) Problem with custom application protocol for exe and xbap (Urgent!)

Matt Galbraith

Hi Martin,

I don't know how to make your solution work as described but you have a couple options... Unfortunately & is a special character to cmd.exe. (it's a command separator... try echo foo&bar to see what I mean)

1) Use a different character than &, such as +. This works as expected. Within your .xbap, you can simply modify the argument-parsing code to switch on this character instead.

2) Use escape characters that mean the same thing... & is ASCII 38, so %26 should appear the same to your browser.

Hope this helps...