Invoking a command line .exe program

S

Simon Harvey

Hi,

I have a simple .exe application that I need to invoke from my C#
application. I need to send it two strings and then get the result back.

Can anyone advise me on how this is done?

Also, I'm currently using a windows forms application but I would like to
use an ASP.net appliocation to invoke the .exe file in the future. Is this
possible and will it cause any complications?

Thanks everyone

Simon
 
C

Christian Heide Damm

Answer to the first part of the question: take a look at
System.Diagnostics.Process.

Christian
 
S

Shiva

Hi,

Did you try System.Diagnostics.Process.Start()?

Hi,

I have a simple .exe application that I need to invoke from my C#
application. I need to send it two strings and then get the result back.

Can anyone advise me on how this is done?

Also, I'm currently using a windows forms application but I would like to
use an ASP.net appliocation to invoke the .exe file in the future. Is this
possible and will it cause any complications?

Thanks everyone

Simon
 
E

Eliyahu Goldin

Simon,

ASP.NET application can invoke an ece in the same way as Windows form one.
The only difference is that you will need to grant "run executable" rights
to account aspnet runs under.

Eliyahu
 
N

Nick Malik

The other responders gave you the answer.

I have a question: did you write the command line app? If so, can it be
rewritten in .NET?
That would give you some better answers when it comes to using resources,
especially if you plan to run this in a server.

Running it from a web page will work, but it won't be terribly scalable.

--- Nick
 
E

Eric Johannsen

Giving the ASPNET account "run executable" rights is a terrible security
hole. I would strongly suggest that you look for another solution to your
problem, perhaps rewriting the executable as a windows service (or wrapping
it on one) and having the ASP application set certain conditions (such as a
flag in the DB) that cause the code currently in the executable to run.

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top