I am trying to open a web page using the default browser when someone hits an API endpoint.
I have this working on my local test machine:
    [HttpGet("Http/{classId}")]
    public void OpenWebLink(Guid classId)
    {
        string target = "http://astrolab.meeting.trl.edu/class/details.aspx?classId=" + classId;
        System.Diagnostics.Process.Start("C:\\Program Files\\Mozilla Firefox\\firefox.exe", target);
    }
But when I publish to a server that has IIS, it can't find firefox.exe
The problem is, I had to put the full path to firefox just to get it to work on my machine. If I didn't include the path like that I'd get this error:
System.Diagnostics.Process.Start Win32Exception: 'The system cannot find the file specified.'
I also tried this:
    [HttpGet("Http")]
    public void OpenWebLink(Guid classId)
    {
        try
        {
            var ps = new ProcessStartInfo("http://astrolab.meeting.trl.edu/class/details.aspx?classId=" + classId;)
            {
                Verb = "open"
            };
        Process.Start(ps);
        }
        catch (Win32Exception w32Ex) 
        {
            throw w32Ex;
        }
    }
But it still fails when I hit the endpoint on the IIS server with this:
System.ComponentModel.Win32Exception (2): The system cannot find the file specified.
Is there a way to set it up so that it will find the default browser on any machine?
Thanks!
 
     
    