使用IE而不是默认浏览器打开url
本文关键字:url 默认浏览器 IE 使用 | 更新日期: 2023-09-27 18:00:31
我有一个应用程序,当你单击按钮时,它会打开SharePoint共享上的文件。在IE中,它会正确地打开文档,如果您对文件进行更改,它会将更改推回到SharePoint服务器,但如果用户的默认浏览器是Firefox,则Firefox会先下载文件,然后使用本地副本。有没有办法强制程序在IE中而不是默认浏览器中打开链接(或者直接打开Word,但我需要在访问文件之前传递用户的域凭据)?
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
将url限制为word文档。
尝试:
System.Diagnostics.Process.Start("iexplore.exe", "http://sp.path.to/your/file.doc")
有关使用参数打开进程的详细信息,请参阅MSDN文档。