Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open url with IE instead of default browser

I have a app that when you click a button it opens a file that is on a SharePoint share. In IE it will open the document in word correctly that if you make changes to the file it will push the changes back to the SharePoint server, however if a user has Firefox as their default browser Firefox will download the file first then use the local copy. Is there a way to force the program to open the link in IE instead of the default browser (or to Word directly, however I need to pass the users domain credentials before I get access to the file)?

BackgroundWorker bw = new BackgroundWorker();
GeneratingChecklist frmProgressBar = new GeneratingChecklist();
frmProgressBar.Show();
bw.DoWork += (sender, e) =>
    {
        e.Result = Build(AccountNumber, PracticeName, ContractID, EducationDate, MainContactInfo, Address);
    };
bw.RunWorkerCompleted += (sender, e) =>
    {
        frmProgressBar.Close();
        running = false;
        if (e.Result != null)
        {
            System.Diagnostics.Process.Start(((FileDetails)e.Result).Address);
        }
        else
        {
            MessageBox.Show("An error occurred generating or retrieving the educator checklist.");
        }
    };
bw.RunWorkerAsync();

FileDetails.Address contrains the url to the word document.

like image 917
Scott Chamberlain Avatar asked Dec 07 '22 20:12

Scott Chamberlain


1 Answers

Try:

System.Diagnostics.Process.Start("iexplore.exe", "http://sp.path.to/your/file.doc")

See the MSDN documentation for more information about opening processes with arguments.

like image 189
lsuarez Avatar answered Dec 18 '22 01:12

lsuarez