开发者

Open url with IE instead of default browser

开发者 https://www.devze.com 2023-03-15 10:04 出处:网络
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

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 ed开发者_运维百科ucator checklist.");
        }
    };
bw.RunWorkerAsync();

FileDetails.Address contrains the url to the word document.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号