从.NET应用程序中打开URL,许多网站(包括StackOverflow)引用了这个例子:
Process.Start("http://www.google.com/");
在Windows 8上,如果Internet Explorer是默认浏览器,则此方法有效。然而,如果Google Chrome是默认浏览器,则会出现以下错误:
Unhandled Exception: System.ComponentModel.Win32Exception: Class not registered
这是否意味着该方法不再是在Windows上打开URL的正确方式?有哪些替代方案?直接启动Internet Explorer是否更安全?
=
时,需要进行转义:Process.Start("explorer.exe", $"\"{url}\"");
- xmedeko