Say I wanted to open test.html in Firefox on the click of a button. How would i do that assuming Firefox is not my default browser?

Member Avatar for saravind84

Hi,

You can use the following function to start firefox.
Pass the file to be open as an argument to this function.

private void StartFirefox(string strFileName)
        {
            ProcessStartInfo psi = new ProcessStartInfo();
            //psi.CreateNoWindow = true;
            psi.WindowStyle = ProcessWindowStyle.Hidden;
            psi.FileName = "firefox.exe";
            psi.Arguments = strFileName;
            Process p = System.Diagnostics.Process.Start(psi);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.