To open a local HTML file in a default browser in .NET I use
Process.Start(s);
where s is a string like "C:\test.html".
This does not work on Mono in OS X and raises a "DDE Failure" error.
I need to improve the code above so that
- It opens in MacOS successfully using Mono
- It actually uses the default browser, not a default handler for HTML files (which could well be Notepad)
I found similar questions on this website but was unable to apply the code therein. I need a piece of code to specifically cover my situation.
EDIT: This is the exact custom error I am getting: "Error while executing: file://C:\users...\Application Data...\temp\book0.html. Message: DDE failure."
I use the code like this to generate the path:
var appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
Path.DirectorySeparatorChar + appName + Path.DirectorySeparatorChar,
tempDir = appDataDir + "temp" + Path.DirectorySeparatorChar,
...
But apparently it's not working.