I am trying to open a file which is residing on the server on a windows machine. I tried using System.Diagnostics like below;
var FullPath = "https://localhost:44389/documents/Open Doc.xlsx";
Process.Start(FullPath);
Everytime I get an error saying the system can not find the specified file but if I take and paste that URL in the browser the file gets downloaded automatically meaning there is a file on the other end. Am I using System.Diagnostics the wrong way?
CodePudding user response:
use this code :
var process = new Process();
process.StartInfo = new ProcessStartInfo("address")
{
UseShellExecute = true
};
process.Start();
If the address is on your Windows, it will run
And if it is an Internet address, it opens it in the browser