Process.Start is a traditional method used in .NET Framework which can't be used in UWP apps directly. To open web URI with Microsoft Edge in UWP, we can use
Launcher.LaunchUriAsync method. For example:
// The URI to launch
string uriToLaunch = @"http://www.bing.com";
// Create a Uri object from a URI string
var uri = new Uri(uriToLaunch);
// Launch the URI
async void DefaultLaunch()
{
// Launch the URI
var success = await Windows.System.Launcher.LaunchUriAsync(uri);
if (success)
{
// URI launched
}
else
{
// URI launch failed
}
}
However this will open the URI with the default web browser. To always open it with Microsoft Edge, we can use Launcher.LaunchUriAsync(Uri, LauncherOptions) method with specified LauncherOptions.TargetApplicationPackageFamilyName property. TargetApplicationPackageFamilyName
property can specify the target package that should be used to launch a file or URI. For Microsoft Edge, its Package Family Name is "Microsoft.MicrosoftEdge_8wekyb3d8bbwe". Following is an example shows how to use this.
// The URI to launch
string uriToLaunch = @"http://www.bing.com";
var uri = new Uri(uriToLaunch);
async void LaunchWithEdge()
{
// Set the option to specify the target package
var options = new Windows.System.LauncherOptions();
options.TargetApplicationPackageFamilyName = "Microsoft.MicrosoftEdge_8wekyb3d8bbwe";
// Launch the URI
var success = await Windows.System.Launcher.LaunchUriAsync(uri, options);
if (success)
{
// URI launched
}
else
{
// URI launch failed
}
}