.Net Core 3.1 Process.Start(“www.website.com”) not working in WPF

前端 未结 1 576
庸人自扰
庸人自扰 2021-01-12 18:53

I am using .Net Core 3.1 Framework in WPF Application. I have a button event in which I am trying to redirect to Instagram url on click. but its giving me the following erro

相关标签:
1条回答
  • 2021-01-12 19:45

    You have to change you code per follows

    var targetURL = "https://www.instagram.com/xyz/";
    var psi = new ProcessStartInfo
    {
        FileName = targetURL,
        UseShellExecute = true
    };
    Process.Start(psi);
    

    UseShellExecute property is set to false in .NET Core by default, to open https:// link you have to set it to true, because it isn't an executable file

    0 讨论(0)
提交回复
热议问题