views:

54

answers:

2

Im trying to see if it is at all possible to call an external (console) application from an ASP.NET MVC app. They will both be build and deployed on internal servers, and both will use a custom form of security, validating the user VIA AD before anything executes, so Im not overly worried about the security risks. Basically, Im trying to build a web based front end for an application so it can be kicked off "anywhere". The web based front end will basically collect all the parameters and pass them to the application at run time.

Any thoughts?

+2  A: 

Create a Process object, and give all the information in the ProcessStartInfo, then just start the process.

Something like:

        Process notepad = new Process();

        notepad.StartInfo.FileName = "notepad.exe";
        notepad.StartInfo.Arguments = "stackoverflow.txt";

        notepad.Start();

That's gotta work when you give your worker process enough rights to start the process. We actually use something the same in one of our applications.

Jan Jongboom
That just seems too easy! I was looking for something more difficult!!!Thanks :)
SlackerCoder
A: 

If you can't have your web app to run processes - I don't know, maybe because ASP.NET service has insuccifient rights, etc - you can have another process run in background, waiting for requests to run console apps. Your ASP.NET MVC app will then communicate with it using pipes or another IPC stuff.

queen3