Executing exe from asp page
i have an exe file that does some pdf processing. i would like to call this exe within an asp page and i want the asp page to wait until the exe has completed processing. any solutio开发者_开发问答n?
thanks -Vivek
Set WshShell = WScript.CreateObject("WScript.Shell")
intReturn = WshShell.Run(Server.MapPath("PathToMyApp.exe"), 1, TRUE)
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");
}
精彩评论