我有一个应用程序页面,它使用 ActiveX 执行安装在客户端上的 exe 文件,但代码只有在 IE 中允许选项时才有效 - “初始化和脚本 ActiveX 控件未标记为可安全执行脚本”启用
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string url = Context.Request.Url.ToString();
ClientScript.RegisterStartupScript(GetType(), "key", string.Format(@"RunEXE('{0}');", url), true);
ClientScript.RegisterStartupScript(GetType(), "redir", string.Format(@"Redir('{0}');", Request.QueryString["Source"]), true);
}
</script>
<asp:Content ID="Main" runat="server" contentplaceholderid="PlaceHolderMain" >
<script language="javascript" type="text/javascript" >
function RunEXE(url)
{
var oShell = new ActiveXObject("Shell.Application");
oShell.ShellExecute('C:/inetpub/wwwroot/SPMananager.exe', url, "", "open", 1);
}
function Redir(url)
{
window.location = url;
}
</script>
</asp:Content>