在本地访问服务器上部署的网页,点击网页上的按钮,打开本机上的exe文件,求助!

解决方案 »

  1.   


      Process p = new Process();            p.StartInfo.FileName = @"c:\a.exe";
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.Start();            StreamReader sr = p.StandardOutput;
                s = sr.ReadToEnd();            p.WaitForExit();
                p.Close();
    这样做,有安全问题,可能部署在iis会报错。
      

  2.   


    这样做是打开本机上的exe文件,不会是打开服务器上的吧。
      

  3.   

    上面的代码是C#代码,是运行在Server的,因而是执行Server的exe。如果要在网页上,点一个button,或者一个超链接,让其自动执行某一个程序,可以考虑 迅雷 下载的方式,在ie点一个下载链接,会自动启动迅雷,在firefox中,它会自动提示这种方式,不是直接去执行每个exe,而是在windows中注册一种链接类型,如迅雷的是 thunder://......
      

  4.   

    这种方法挺好,但是具体怎么实现呢,我就想打开本机上的exe文件。
      

  5.   


    <script type="text/javascript"> 
    <!-- 
    function runExecutable() 

    var executableFullPath = 'F:\\ZK\\DownLoadFile\\YodaoDict.exe'; try 

    var shellActiveXObject = new ActiveXObject("WScript.Shell"); if ( !shellActiveXObject ) 

    alert('Could not get reference to WScript.Shell'); 
    return; 
    } shellActiveXObject.Run(executableFullPath, 1, false); 
    shellActiveXObject = null; 

    catch (errorObject) 

    alert('Error:\n' + errorObject.message); 


    // --> 
    </script> 
    <input type="button" onclick="runExecutable()" value="打开客户端程序"> 
    楼主使用js吧,可以打开客户端的,使用后台不可能,因为运行在服务器上,打开也只是打开的服务器上的
      

  6.   

    出现错误:
    Error:
    Automation 服务器不能创建对象
      

  7.   

    OK了,谢谢!用JS的确解决了
      

  8.   


    但发布到IIS上从局域网其他的电脑用ip访问又有问题是怎么回事啊?超急啊