如何使用C#启动包含特定url的Google Chrome标签

有没有办法在谷歌浏览器中启动一个标签(而非新窗口),并在自定义应用中加载特定的URL? 我的应用程序使用C#(.NET 4 Full)编码。

我正在通过C#中的SOAP执行一些操作,一旦成功完成,我希望通过浏览器向用户呈现最终结果。

整个设置适用于我们的内部网络而不是公共消费 – 因此,我可以承受仅针对特定浏览器的费用。 出于各种原因,我针对Chrome

作为chrfin响应的简化,由于Chrome应该在运行路径上安装,你可以调用:

Process.Start("chrome.exe", "http://www.YourUrl.com"); 

这似乎对我有用,如果Chrome已经打开,则会打开一个新标签。

 // open in default browser Process.Start("http://www.stackoverflow.net"); // open in Internet Explorer Process.Start("iexplore", @"http://www.stackoverflow.net/"); // open in Firefox Process.Start("firefox", @"http://www.stackoverflow.net/"); // open in Google Chrome Process.Start("chrome", @"http://www.stackoverflow.net/"); 

更新:请参阅Dylan或dc’s anwer以获得更简单(更稳定)的解决方案,该解决方案不依赖于LocalAppData安装的Chrome浏览器!


即使我同意Daniel Hilgarth在chrome中打开一个新选项卡,您只需要以URL作为参数执行chrome.exe:

 Process.Start(@"%AppData%\..\Local\Google\Chrome\Application\chrome.exe", "http:\\www.YourUrl.com"); 

如果用户没有Chrome,则会抛出如下exception:

  //chrome.exe http://xxx.xxx.xxx --incognito //chrome.exe http://xxx.xxx.xxx -incognito //chrome.exe --incognito http://xxx.xxx.xxx //chrome.exe -incognito http://xxx.xxx.xxx private static void Chrome(string link) { string url = ""; if (!string.IsNullOrEmpty(link)) //if empty just run the browser { if (link.Contains('.')) //check if it's an url or a google search { url = link; } else { url = "https://www.google.com/search?q=" + link.Replace(" ", "+"); } } try { Process.Start("chrome.exe", url + " --incognito"); } catch (System.ComponentModel.Win32Exception e) { MessageBox.Show("Unable to find Google Chrome...", "chrome.exe not found!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }