System.Diagnostics.Process.Start(" HTTP://google.com")崩溃IE [英] System.Diagnostics.Process.Start("http://google.com") crashes IE
问题描述
好了,我在这里有一个大脑放屁。这应该是简单的,但我失去了一些东西。
Okay I'm having a brain fart here. This should be simple, but I'm missing something.
我有一个双赢的形式,我想推出一个网页,当我点击一个按钮。在$ C $下按钮就在这里:
I've got a win form and I'm trying to launch a web page when I click a button. The code for the button is here:
private void button2_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start("http://www.google.com");
}
catch (Win32Exception ex)
{
Console.WriteLine(ex.Message);
lblError.Text = ex.Message;
}
}
当我运行此我的电脑上,它工作正常。在其他计算机上,它仅适用,如果你有一个浏览器已经打开。如果你没有一个浏览器中打开,它会打开浏览器,然后只是挂起。是什么给了?
When I run this on my computer, it works fine. On other computers, it only works if you have a browser already open. If you don't have a browser open, it opens the browser then just hangs. What gives?
我也试过
`System.Diagnostics.Process.Start("IExplore.exe", "http://www.google.com");`
忽略了默认浏览器(这是我想避免的,但如果它的工作原理,它的工作原理)。我得到了相同的结果。
ignoring the default browser (something I'd like to avoid but if it works, it works). I get the same result.
感谢您的帮助。
编辑:我也开到推出一个网页有一个按钮,如果任何你能想到一个其他的方法。
I'm also open to other methods of launching a web page with a button if any of you can think of one.
推荐答案
好了,我懂了工作。我把Thinstall的方程,它可以神奇地运行在每台计算机上。谢谢你们的帮助和建议。
Okay, I got it working. I took Thinstall out of the equation and it magically works on every computer. Thanks guys for the help and suggestions.
这篇关于System.Diagnostics.Process.Start(" HTTP://google.com")崩溃IE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!