0

I am having trouble with System.Diagnostics.Process.Start. It's supposed to open combinedURL, which basically is a local html file with some extra URL.

 string projectPath = C:\Users\d\Desktop\project\start.html
 StringBuilder sb = new StringBuilder(projectPath);
                sb.Replace("start.html", "Test_Erkl.html?custid=TST-Pesent&Document=0");

                string combinedURL = Convert.ToString("file:" + "///" + sb);
                System.Diagnostics.Process.Start(combinedURL);

As a result it opens C:\Users\d\Desktop\project\Test_Erkl.html instead of C:\Users\d\Desktop\project\Test_Erkl.html?custid=TST-Pesent&Document=0. However, if I add firefox.exe to it, it works as intended.

     System.Diagnostics.Process.Start("firefox.exe", combinedURL);

Why does it cut everything off, after the ? and how can I make it work without adding firefox.exe (or is there something like defaultbrowser.exe?)

kiunx3
  • 43
  • 6
  • 1
    See [this](https://stackoverflow.com/a/2787987/7571171) for a way to pass parameters to a html file using `Process.Start` and finding out the default browser path. – Thomas Flinkow Jul 09 '20 at 07:01
  • Have you seen [this answer](https://stackoverflow.com/a/10504367/1997232)? Why your first approach doesn't work doesn't really matter, it's just not an allowed way. First parameter is executable, anything else should be parameters. – Sinatr Jul 09 '20 at 07:02

0 Answers0