无法运行ActiveXObject(“Shell.Application”);

时间:2012-04-24 07:57:49

标签: activexobject

您好我有应用程序页面,它使用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>

1 个答案:

答案 0 :(得分:0)

Shell.Application未标记为“可安全执行脚本”,因为它很容易被滥用。

您不希望访问能够破坏Windows安装的网站。