URL Scheme registered app (Window) closes after launch

Viewed 27

This is turning into a real head-scratcher.

I have registered my app (C# WPF) with a custom URL scheme in Windows, as is laid out in this blog:

https://www.meziantou.net/registering-an-application-to-a-uri-scheme-using-net.htm

So my example:

<html>
<head></head>
<body>
    <p>
        <a href="myUri://Param1:Value1/Param2:Value2">User Displayed Text</a>
    </p>
</body>
</html>

It works well, in that it launches the application with the command-line-argument, and the behavior is as expected.

HOWEVER, the application then closes within 20 seconds or so, and its behavior is as though the user clicked the "Close Window" button on the application's window.

If I create a shortcut to my application and give it a parameter just as the web URI link launches, the app runs correctly indefinitely.

E.G.

"C:\MyAppFolder\MyApp.exe" "myUri://Param1:Value1/Param2:Value2"

My instincts are saying that this is some sort of security behavior with the app launching from a web browser, but I can't find anything on this, and was wondering if anyone can enlighten me?

Thanks!

0 Answers
Related