Process.Start("IExplore.exe");
Does this always work, on every machine ? If not, how to do it properly ?
... EDIT: .................................
The problem with Process.Start("http://www.example.com/"); is that we have to target a local html file, with some querystring specifying which page to load in the html frameset. So our URL looks like the following:
G:\PathToHelpFolder\index.html#search?page=1.html
If you pass this path to Process.Start, an error is generated: "cannot find the file". This is caused by the querystring at the end. (#search?page=1.html)
So, we have to start explorer (or default browser would be better) with the filepath as a command line argument. We found the method above at the MSDN documentation. (Process.Start("IExplore.exe");) Our only question is if this method is reliable enough to deploy to a commercial app. Mono isn't a problem, only windows systems are targeted.
... EDIT : Our solution ......
Our solution was to get the default browser from the registry, and start that with the filename as argument. (as stated in: Launching default browser with html from file, then jump to specific anchor)
If your goal is to open a browser to go to a specific page, it's better to use just the page URL:
Process.Start("http://www.example.com/");
That way, the user's default browser will be used. (I, for one, would be annoyed to be forced into using IE.)
I once needed the default browser's name (without opening) for a stupid application I built, I found a great tutorial over here: http://ryanfarley.com/blog/archive/2004/05/16/649.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With