Forum Moderators: open

Message Too Old, No Replies

running .exe file

         

itssankar

6:40 am on Aug 16, 2004 (gmt 0)

10+ Year Member



i want to run a .exe file while click on a link on my web page. how its possible am using asp.net.

raywood

1:45 pm on Aug 17, 2004 (gmt 0)

10+ Year Member



dotNET has a built in Process class. You can use it to create a process object. You set up the particulars like any input/output parameters using the members of the StartInfo property. Then you start the process with the Start method.

On shared servers you may not have permission to run executables in your virtual directory. In Win2003 the aspnet worker process has default execute permission on the winnt/temp directory, so I usually copy the executable there first. I copy it each time, because the sysadmin may delete the temp files any old time. Then I kill the file when it is finished.

You need to establish some way to determine when the executable is finished so you can dispose the process object. I usually make a loop to check for some finished condition and sleep the thread each time through the loop until it gets a successful completion. I also use a timer to bail out if I don't get success within some reasonable time.