I have a web application which needs to call a console application and capture the output of that execution process.
What I have is the following:
Expand|Select|Wrap|Line Numbers
- ProcessStartInfo psi = new ProcessStartInfo();
- psi.WindowStyle = ProcessWindowStyle.Hidden;
- psi.FileName = "doTask.exe";
- psi.Arguments = "abc";
- psi.UseShellExecute = false;
- psi.CreateNoWindow = true;
- psi.RedirectStandardOutput = true;
- Process proc = new Process()
- proc.StartInfo = psi;
- proc.Start();
- string output = proc.StandardOutput.ReadToEnd();
- proc.WaitForExit();
- // print the output from this execution process on a web page.. etc
However, I have tried to use the same code on a standalone windows app and it's working as expected. Just that when I run this code on a webpage, it just doesn't do what I expected.
Thanks !!