troubleshooting Question

How to pass the output of DOS command exectued from C# code to the display of asp.net page. To tell user about the progress.

Avatar of KenPC
KenPC asked on
Web Languages and StandardsC#ASP.NET
3 Comments1 Solution1927 ViewsLast Modified:
Hi Experts,

I'm doing asp.net development. And I'm using C# to execute DOS commands(which the DOS command line execute some test application).

Once the user click the Execute Button(just a regular asp.net button, that the event invoke the execution of DOS command) at the asp.net page,  the DOS command would be executed.

I would like to pass the output/debug messages or any messages output by the DOS command to the asp.net page so that user can see the progress and some information about the DOS command execution.

Note:
My DOS command is to call the source control(MKS) application to create a sandbox in my pc. I would like to pass the messages output by this command to the asp.net page. (When I execute this DOS  command in DOS prompt it would output the error messages e.g pass, fail to create sandbox, and etc.)

Note:
Dumping the output to the label would work. But how to get the output/debug messages of the DOS exectution in C#.?


string mksCreateVariantSandboxCmdStr = @"si createsandbox -R --populate --project=" + getProjectNameStr() + @" --devpath=" + getVariantNameStr() + @" --status=default --yes " + getSandPathStr();
 
//Working example of executing dos command in C#
        //create & mapping the variant sandbox
        System.Diagnostics.Process processCrVarSandBox = new System.Diagnostics.Process();
        processCrVarSandBox.EnableRaisingEvents = false;
        System.Diagnostics.Process.Start("cmd.exe", @"/C " + mksCreateVariantSandboxCmdStr);
        processCrVarSandBox.Close();
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros