i'm new in C# programming so I beg your pardon. I just tried the solution proposed in a previous question, but it didn't work. By the way I stil need help. I'm trying to write a simple consolle app in C# that opens a web page, aka http://www.libero.it. Here you are my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
class OpenWeb {
static void Main(string[] args) {
var prs = new ProcessStartInfo("chrome.exe");
prs.Arguments = "http://www.libero.it";
// Process.Start(prs);
try
{
Process.Start(prs);
}
catch (System.ComponentModel.Win32Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
I don't understand why my code doesn't work, there is always an exeception, without the try-catch is the following:
Unhandled Exception: System.ComponentModel.Win32Exception: The specified file
could not be found
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo
startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at OpenWeb.Main(String[] args) in C:\Users\p3rtp\myProve\Prove.cs:line 12
I use Windows 7x64, with .Net core sdk 2.1.301 e MS Visual Studio Code 1.24.1.