从asp页面执行exe

时间:2010-06-10 17:02:38

标签: asp-classic

我有一个exe文件,可以进行一些pdf处理。我想在一个asp页面中调用这个exe,我希望asp页面等到exe完成处理。任何解决方案?

感谢 -Vivek

2 个答案:

答案 0 :(得分:2)

Set WshShell = WScript.CreateObject("WScript.Shell")
intReturn = WshShell.Run(Server.MapPath("PathToMyApp.exe"), 1, TRUE)

答案 1 :(得分: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");
        }