This is a discussion on How to call a program using the command prompt from ASP.NET. Basically all it needs within the ASP and ASP.NET Programming forums, part of the Web Development category; How to call a program using the command prompt from ASP.NET. Basically all it needs to do is (upon ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| How to call a program using the command prompt from ASP.NET. Basically all it needs to do is (upon pressing a button)call the prompt, 'cd' to the right directory and execute the appropriate app. Is there an easy way to do this? |
| Sponsored Links |
| |||
| // Get a file name relative to the current Web app. string file = Server.MapPath(@"binMyApp.exe"); ProcessStartInfo info = new ProcessStartInfo(file, "args"); // Redirect output so we can read it. info.RedirectStandardOutput = true; // To redirect, we must not use shell execute. info.UseShellExecute = false; // Create and execute the process. Process p = Process.Start(info); p.Start(); // Send whatever was returned through the output to the client. Response.Write(p.StandardOutput.ReadToEnd()); Note that the ASP.NET worker process needs to have permissions to access the external application. The most simple way to ensure this is to place it under the bin folder. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| difference between call by value and call by reference | amansundar | Java Programming | 2 | 09-18-2007 01:34 AM |
| Get dos prompt | simplesabita | Testing Tools | 1 | 08-22-2007 04:39 AM |
| Function call and System call | vigneshgets | Operating Systems | 1 | 08-01-2007 06:18 AM |
| How to launch Real Player program through my j2me midlet program? | itbarota | J2ME | 1 | 07-25-2007 11:39 PM |
| How can I invoke another program or command and trap its output in C? | Sabari | C and C++ Programming | 1 | 07-17-2007 04:01 AM |