服务器有一EXE 希望 点击页面上的一个按钮时启动这个EXE,怎么做?

解决方案 »

  1.   

    好像见过一些OA系统中有这一功能,你可以下载一个看下,51aspx 里面就有 
      

  2.   

    一般来说不建议这样吧.如果有权限的话,可以使用processinfo来运行.打开一个进程的.
      

  3.   


    using System;
    using System.Diagnostics;
    using System.ComponentModel;namespace MyProcessSample
    {
        /// <summary>
        /// Shell for the sample.
        /// </summary>
        class MyProcess
        {
           
            /// <summary>
            /// Opens the Internet Explorer application.
            /// </summary>
            void OpenApplication(string myFavoritesPath)
            {
                // Start Internet Explorer. Defaults to the home page.
                Process.Start("IExplore.exe");
                        
                // Display the contents of the favorites folder in the browser.
                Process.Start(myFavoritesPath);
     
            }
            
            /// <summary>
            /// Opens urls and .html documents using Internet Explorer.
            /// </summary>
            void OpenWithArguments()
            {
                // url's are not considered documents. They can only be opened
                // by passing them as arguments.
                Process.Start("IExplore.exe", "www.northwindtraders.com");
                
                // Start a Web page using a browser associated with .html and .asp files.
                Process.Start("IExplore.exe", "C:\\myPath\\myFile.htm");
                Process.Start("IExplore.exe", "C:\\myPath\\myFile.asp");
            }
            
            /// <summary>
            /// Uses the ProcessStartInfo class to start new processes, both in a minimized 
            /// mode.
            /// </summary>
            void OpenWithStartInfo()
            {
                
                ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
                startInfo.WindowStyle = ProcessWindowStyle.Minimized;
                
                Process.Start(startInfo);
                
                startInfo.Arguments = "www.northwindtraders.com";            Process.Start(startInfo);
                            
            }        static void Main()
            {
                        // Get the path that stores favorite links.
                        string myFavoritesPath = 
                        Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
                    
                        MyProcess myProcess = new MyProcess();
             
                myProcess.OpenApplication(myFavoritesPath);
                myProcess.OpenWithArguments();
                myProcess.OpenWithStartInfo();               }    
        }
    }
      

  4.   

    四楼是在winform程序里启动浏览器吧
      

  5.   

    这样做有什么意义?默认的asp.net的用户没有权限这样做,当然可以使用模拟用户
      

  6.   

    在网上看到一篇文章,不知道是不是楼主所需,楼主可以看一下:
    http://www.cnblogs.com/leah/articles/50261.html
      

  7.   

    在网页上想实现这样的效果出于安全基本是不允许
    建议你用activeX来做吧
      

  8.   

    仅仅用.NET运行exe程序,应该很容易的啊. 就像4楼帖的代码给出的例子
      

  9.   

    建议你写一个Windows Service,长期在后台等待。如果你的ASP.NET要做某项操作,就发一个消息给这个Windows Service,让它来做这个需要高权限才能完成的操作,而不要直接调用exe文件。发送消息,你可以用MSMQ,或者自己定制一个消息数据表,Windows Service定期查询数据表中是否有新消息。