Open a web site in C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Open a web site in C#

Hello, I have a Problem And I need you to solve it. I use C# to do an AI like Siri but in console And I don't know how we can do it to open a web site with C# Important : I don't do an web App but an app on console

3rd Dec 2022, 5:28 PM
Mathéo
Mathéo - avatar
7 Answers
+ 2
If I understand correctly what you're trying to do, then probably HttpClient can help you. https://zetcode.com/csharp/readwebpage/
3rd Dec 2022, 6:00 PM
Tibor Santa
Tibor Santa - avatar
+ 1
HttpClient is ... an http client and is for make http requests and get the response for futher app processing
3rd Dec 2022, 9:20 PM
KrOW
KrOW - avatar
+ 1
The you want open a browser with an url, right? If its this, depends from the browser but all major browser support passing the url as argument for open that web page. You can try to pass the full path of your browser (at example chrome) and as secondary params the url like: Process.Start(pathToChromeExe, "https://www.google.com");
4th Dec 2022, 10:23 AM
KrOW
KrOW - avatar
+ 1
Mathéo Right
4th Dec 2022, 2:25 PM
KrOW
KrOW - avatar
0
But it even works if it’s not for html program ?
3rd Dec 2022, 7:23 PM
Mathéo
Mathéo - avatar
0
i want to do something like that my code is below: using System; using System.Diagnostics; namespace test { class Program { static void Main(string[] args) { Process.Start("https://www.google.com"); } } } but that didn't work and i want to know how I can fix it Thank you
4th Dec 2022, 10:11 AM
Mathéo
Mathéo - avatar
0
Ok thank you if that work like that I have just a question As first param, I pass the path of my chrome app on my computer right ?
4th Dec 2022, 11:45 AM
Mathéo
Mathéo - avatar