2010-06-10 85 views
2

我有一個EXE文件,做一些PDF處理。我想調用這個exe文件在一個asp頁面,我希望asp頁面等待exe文件完成處理。任何解決方案從ASP頁執行EXE

感謝 -Vivek

回答

2
Set WshShell = WScript.CreateObject("WScript.Shell") 
intReturn = WshShell.Run(Server.MapPath("PathToMyApp.exe"), 1, TRUE) 
0
public ActionResult RunReport() 
     { 
      //Set this page timeout 
      HttpContext.Server.ScriptTimeout = int.MaxValue; 

      var psi = new ProcessStartInfo() 
      { 
       //Arguments = string.Format("/k \"\"Test.exe\" \"{0}\" \"{1}\" \"{2}\"\"", arg1, arg2, arg3), 
       CreateNoWindow = false, 
       UseShellExecute = true, 
       WorkingDirectory = @"C:\Test", 
       FileName = "Test.exe" 
      }; 

      using (var process = Process.Start(psi)) 
      { 
       process.WaitForExit(int.MaxValue); 
      } 

      return RedirectToAction("Index"); 
     }