How to open a specific URL

Viewed 181

I want to open an url with

Process.Start("https://www.youtube.com/watch?v=8_oOES_uKPI");

When I run my code I get the following error:

System.ComponentModel.Win32Exception: 'An error occurred trying to start process 'https://www.youtube.com/watch?v=8_oOES_uKPI' with working directory 'C:\Users('_')\source\repos\messingAROUND\messingAROUND\bin\Debug\net6.0'. The system cannot find the file specified.'

What am I doing wrong?

1 Answers

Process.Start("fileName","arguments") and in our case let's say you have google chrome installed so you Should replace "fileName" with chrome.exe and "arguments" with your url by example "google.com" and so on So Change the below solution

Process.Start("chrome.exe","google.com")

For Default Browser

Process.Start("rundll32", "url.dll,FileProtocolHandler https://www.google.com");

Thanks and have fun.

Related