Render HTML file with C# console application and open it in browser
I created an application which rendered a report in HTML. To improve it, I wanted it to open the rendered file in browser to simplify the viewing one. In the beginning I thought about using the CMD file, but I found a better solution.
You can execute an application from C# console application. It's a simple task to start a browser and to open the rendered file. It take to write 4 strings of code.
At first, you should add string "using System.Diagnostics;" at the top of your app code, you can write it below System.something 🙂 .
Secondly, add these 3 lines to your app after the file is generated:
var prs = new ProcessStartInfo("iexplore.exe");
prs.Arguments = newResultFile;
Process.Start(Directory.GetCurrentDirectory() + @"\myfile.html";);
Now build and execute the app. The rendered file will be opened with Internet explorer.