我有micromedia flash播放器的exe文件。我可以使用以下代码从.net应用程序运行此文件
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("peopledisplay.exe");
//System.Diagnostics.Process.Start("iexplorer.exe", "peopledisplay.exe");
}
此代码在单击按钮后启动micromedia Flash文件。我希望在单击按钮后在Internet浏览器中启动此文件。这该怎么做 ?能否请您提供我可以解决上述问题的任何代码或链接?
答案 0 :(得分:1)
试试这个:
System.Diagnostics.Process.Start(@"\"C:\Program Files (x86)\Internet Explorer\iexplore.exe\" \"[path to my file]\"");
您需要在IE的命令行中指定flash文件的路径。确保用引号将路径括起来。当然,这并不能保证IE实际上能够运行该文件,您可能会发现安全限制(区域规则,组策略)阻止了这一点。
答案 1 :(得分:0)
您在此代码中执行的操作是告诉服务器打开可执行文件,而不是浏览器客户端。您需要一些类似以下的JavaScript,但这可能仅适用于Internet Explorer,并且仅当用户在IE选项窗口中显式设置权限时才会使用。
<script>
function go() {
w = new ActiveXObject("WScript.Shell");
w.run('peopledisplay.exe');
return true;
}
</script>
<form>
Run Notepad (Window with explorer only)
<input type="button" value="Go"
onClick="return go()">
</form>