如何从.NET客户端应用程序加载URL

时间:2020-03-06 14:22:04  来源:igfitidea点击:

使用Cand .NET框架从Windows上的胖客户端应用程序中打开URL的首选方法是什么?我希望它使用默认浏览器。

解决方案

我将使用Process.Start方法。

Process.Start("http://www.google.com/");

private void launchURL_Click(object sender, System.EventArgs e){
 string targetURL = "http://stackoverflow.com";
 System.Diagnostics.Process.Start(targetURL);
}

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

以下代码肯定有效:

Process.Start("http://www.yoururl.com/Blah.aspx");

它会打开默认浏览器(从技术上讲,它是处理HTTP URI的默认程序)。