Reputation: 1163
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 solution?
thanks -Vivek
Upvotes: 3
Views: 2543
Reputation: 4223
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");
}
Upvotes: -1
Reputation: 171411
Set WshShell = WScript.CreateObject("WScript.Shell")
intReturn = WshShell.Run(Server.MapPath("PathToMyApp.exe"), 1, TRUE)
Upvotes: 3