Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从C#打开2个URL?_C# - Fatal编程技术网

如何从C#打开2个URL?

如何从C#打开2个URL?,c#,C#,好的,听起来很简单,我知道我可以使用Process.Start(“”) 但是我需要一次打开两个网站!!差不多 进程。开始(“”); 进程。开始(“”) 我无法让它工作,因为在这个过程中,它只打开第二个站点 任何帮助都将不胜感激 谢谢 Process.Start("iexplore","http://www.google.com"); Process.Start("iexplore", "http://www.yahoo.com"); 这将打开IE的两个副本。您希望这种行为,还是

好的,听起来很简单,我知道我可以使用Process.Start(“”)

但是我需要一次打开两个网站!!差不多

进程。开始(“”); 进程。开始(“”)

我无法让它工作,因为在这个过程中,它只打开第二个站点

任何帮助都将不胜感激

谢谢

    Process.Start("iexplore","http://www.google.com");
    Process.Start("iexplore", "http://www.yahoo.com");
这将打开IE的两个副本。您希望这种行为,还是希望它们在一个浏览器选项卡中


这将打开IE的两个副本。您希望该行为,还是希望它们在一个浏览器选项卡中?

编辑Oops,没有阅读整个问题,请忽略此问题:)

对不起,B免费,但我讨厌你强迫用户使用Internet explorer

请改用此代码:

System.Diagnostics.Process.Start("http://www.geekpedia.com");

编辑Oops,没有阅读整个问题,请忽略以下内容:)

对不起,B免费,但我讨厌你强迫用户使用Internet explorer

请改用此代码:

System.Diagnostics.Process.Start("http://www.geekpedia.com");

您可以尝试在新线程中打开每个线程

Thread thread1 = new Thread(new ThreadStart(Process.Start("http://mysite")));
thread1.Start();

Thread thread2 = new Thread(new ThreadStart(Process.Start("http://othersite")));
thread2.Start();

thread1.Join();
thread2.Join();

您可以尝试在新线程中打开每个线程

Thread thread1 = new Thread(new ThreadStart(Process.Start("http://mysite")));
thread1.Start();

Thread thread2 = new Thread(new ThreadStart(Process.Start("http://othersite")));
thread2.Start();

thread1.Join();
thread2.Join();

它的工作原理应该与从windows run(Win-R)运行完全相同。原因可能在于浏览器的设置。在默认浏览器的选项中选择“使用相同的窗口打开链接”之类的选项。

它的工作原理应该与从windows run(Win-R)运行它完全相同。原因可能在于浏览器的设置。在默认浏览器的选项中选择“使用相同的窗口打开链接”之类的选项。

尝试在进程开始调用之间放置一个
Thread.Sleep(15000)
。然后你应该更清楚地看到发生了什么。我猜这是默认浏览器设置中的某个内容,第二个URL将加载到与第一个相同的窗口中。

尝试在进程开始调用之间放置一个
线程。Sleep(15000)
。然后你应该更清楚地看到发生了什么。我猜这是您默认的浏览器设置,第二个URL将加载到与第一个相同的窗口中。

再次阅读他的问题。他尝试了Process.Start(“http…”),但没有成功。我自己测试了一下以确认。如果您只使用Process.Start(“http…”);Process.Start(“http:…”);它只会打开后者。我展示的方式,虽然只有IE打开了这两个。再次阅读他的问题。他尝试了Process.Start(“http…”),但没有成功。我自己测试了一下以确认。如果您只使用Process.Start(“http…”);Process.Start(“http:…”);它只会打开后者。我展示的方式,虽然只有IE打开了它们。