Y
Yehuda Vernik
Hi All.
I am trying to run an exe application under aspx page using
System.Diagnostics.ProcessStartInfo and System.Diagnostics.Process.
The process gets started but "freezes" without any error messages. The
process output stream gives me something like this:
C:\Inetpub\wwwroot\Portal\script>MyProgram.exe MyArguments
C:\Inetpub\wwwroot\Portal\script>
--------------------------
instead of:
C:\Inetpub\wwwroot\Portal\script>MyProgram.exe MyArguments
MyProgramExecutionOutput
MyProgramExecutionOutput
MyProgramExecutionOutput
C:\Inetpub\wwwroot\Portal\script>
I made sure that the folder C:\Inetpub\wwwroot\Portal\script is configured
under IIS to run executables.
I also made sure that .NET Configuration 1.1 Machine and User have full
trust.
What else you suggest I need to check?
Is there any site that explans all the security settings that I need to go
over in order to run CMD.EXE?
Thanks a lot,
Yehuda
My code:
-------------------------------------------
System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.WorkingDirectory = @"c:\Inetpub\wwwroot\Portal\script";
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
System.IO.StreamWriter streamIn = proc.StandardInput;
System.IO.StreamReader streamOut = proc.StandardOutput;
String strCommand =
@"gpg.exe -d --batch --passphrase-fd 0 -r funds -o
C:\Inetpub\wwwroot\Portal\script\files_xml\2004091010.XML
C:\Inetpub\wwwroot\Portal\script\2004091010.XML.asc < funds.txt";
streamIn.WriteLine(strCommand);
proc.WaitForExit(2000);
streamIn.WriteLine("EXIT");
proc.Close();
string results = streamOut.ReadToEnd().Trim();
streamIn.Close();
streamOut.Close();
I am trying to run an exe application under aspx page using
System.Diagnostics.ProcessStartInfo and System.Diagnostics.Process.
The process gets started but "freezes" without any error messages. The
process output stream gives me something like this:
C:\Inetpub\wwwroot\Portal\script>MyProgram.exe MyArguments
C:\Inetpub\wwwroot\Portal\script>
--------------------------
instead of:
C:\Inetpub\wwwroot\Portal\script>MyProgram.exe MyArguments
MyProgramExecutionOutput
MyProgramExecutionOutput
MyProgramExecutionOutput
C:\Inetpub\wwwroot\Portal\script>
I made sure that the folder C:\Inetpub\wwwroot\Portal\script is configured
under IIS to run executables.
I also made sure that .NET Configuration 1.1 Machine and User have full
trust.
What else you suggest I need to check?
Is there any site that explans all the security settings that I need to go
over in order to run CMD.EXE?
Thanks a lot,
Yehuda
My code:
-------------------------------------------
System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.WorkingDirectory = @"c:\Inetpub\wwwroot\Portal\script";
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
System.IO.StreamWriter streamIn = proc.StandardInput;
System.IO.StreamReader streamOut = proc.StandardOutput;
String strCommand =
@"gpg.exe -d --batch --passphrase-fd 0 -r funds -o
C:\Inetpub\wwwroot\Portal\script\files_xml\2004091010.XML
C:\Inetpub\wwwroot\Portal\script\2004091010.XML.asc < funds.txt";
streamIn.WriteLine(strCommand);
proc.WaitForExit(2000);
streamIn.WriteLine("EXIT");
proc.Close();
string results = streamOut.ReadToEnd().Trim();
streamIn.Close();
streamOut.Close();