Intro:
I've hit a design wall and encountered a issue that is beyond me. I could use guidance.
I am creating a application and I'd like to use url protocols for accessibility/security and user convivence. Until I'm ready to build a API. I have codded the features I want thus far into my app including a download method and a standard url protocool procedure.
Problem:
All the download addresses I'm using are encoded and require WebUtility.UrlDecode() after parsing to extract a useable download address. The question is: How can I store the address generated upon left-clicking it and pass it to my file downloader method? I'm confused on how to accomplish this task. To reiterate: I want to capture a portion of my url protocol hosted online via left-click and store it in a variable to use.
How program should run:
NOTE: ✔️ = working. ❌ = not working.
- A unknown user is on "a page" and presented with a choice to Download & Install via through App✔️
- User left-clicks the hyperlink. ✔️
- Download address information is passed to the application. ❌
- Application opens. ✔️
- Download initiates of "x-item" and installs (only works when I manually insert a link). ✔️
Practical address example:
<a href="myApp://https%4A%7F%0B.amazon.8943fj9f8j3%2Ftest.json" target="_blank">Download & Install via myApp</a>
I'd want to store...
https%4A%7F%0B.amazon.8943fj9f8j3%2Ftest.json //store this. 
//and it would be decoded and made into a usable address to download from...
Example code...
//output desired from the original url. 
string arg = "https%4A%7F%0B.amazon.8943fj9f8j3%2Ftest.json ";
string encoded_url = arg.Trim().Split('/').Last();
string url = Uri.UnescapeDataString(enc_url);
//output example --> https://www.example.com/yadayada/sample.json
TLDR: For simplicity and clarity...in my mind the application would work similarly to how a user would join a discord server. A user would click a discord server invite-hyperlink and then the discord app would open with a prompting message asking...if the user would like to join the server.
Rudimentary Code.
        static void Main()
            //TESTING...START
            string[] args = Environment.GetCommandLineArgs();
            //args[0] is always the path to the application
            RegisterMyAppProtocol(args[0]);
            //the above method posted before, that edits registry      
            try
            {
                Console.WriteLine("Argument: " + args[1].Replace("myapp:", string.Empty));
            }
            catch
            {
                Console.WriteLine("No argument(s)");  //if there's an exception, there's no argument
            }
            Console.ReadLine();
            //TESTING...END
        }
        static void RegisterMyAppProtocol(string AppPath)  //myAppPath = full path to application
        {
            //open myApp protocol's subkey
            RegistryKey key = Registry.ClassesRoot.OpenSubKey("myApp");
            //if the protocol is not registered yet...register it
            if (key == null)  
            {
                key = Registry.ClassesRoot.CreateSubKey("myApp");
                key.SetValue(string.Empty, "URL: myApp Protocol");
                key.SetValue("URL Protocol", string.Empty);
                key = key.CreateSubKey(@"shell\open\command");
                key.SetValue(string.Empty, AppPath.Replace("dll", "exe") + " " + "%1");
                //%1 represents the argument - this tells windows to open this program with an argument / parameter
            }
            key.Close();
        }
