How to open a web page from my application?
For desktop versions of .NET:
System.Diagnostics.Process.Start("http://www.webpage.com");
For .NET Core, the default for ProcessStartInfo.UseShellExecute
has changed from true
to false
, and so you have to explicitly set it to true
for this to work:
System.Diagnostics.Process.Start(new ProcessStartInfo
{
FileName = "http://www.webpage.com",
UseShellExecute = true
});
To further complicate matters, this property cannot be set to true
for UWP apps (so none of these solutions are usable for UWP).
Accepted answer no longer works on .NET Core 3. To make it work, use the following method:
var psi = new ProcessStartInfo
{
FileName = url,
UseShellExecute = true
};
Process.Start (psi);