Ask a Question related to ASP.NET Security, Design and Development.
-
Yehuda Vernik #1
Cannot execute command line program in cmd.exe under aspx form
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\2004091 010.XML
C:\Inetpub\wwwroot\Portal\script\2004091010.XML.as c < funds.txt";
streamIn.WriteLine(strCommand);
proc.WaitForExit(2000);
streamIn.WriteLine("EXIT");
proc.Close();
string results = streamOut.ReadToEnd().Trim();
streamIn.Close();
streamOut.Close();
--------------
I have copies of cmd.exe file in my BIN folder and my
c:\Inetpub\wwwroot\Portal\script folder.
Yehuda Vernik Guest
-
RUN/execute a Command-Line command from an ASP page
Hi, I need to RUN/execute a Command-Line command from an ASP page. This is the command: sse45.exe -i k:\o\2.wmv -o k:\o\2.shh -w 128 -df 0 -m 2... -
RUN/execute a Command-Line command from an ASP page.
Hi, I need to RUN/execute a Command-Line command from an ASP page. This is the command: sse45.exe -i k:\o\2.wmv -o k:\o\2.shh -w 128 -df 0 -m 2... -
[PHP] execute command line script from browser
Is there a way to execute a command line php script from a browser by, say clicking a button and then having the browser let go and let the script... -
execute command line script from browser
Is there a way to execute a command line php script from a browser by, say clicking a button and then having the browser let go and let the script... -
how to execute command line in ASP
Hi all, Does anyone know how to execute command line in ASP? thanks David



Reply With Quote

