Thursday, November 27, 2008

How to execute exe file in a web application

First of all we need to understand that under the existing web request process mechanism you can not make any executable application that exists on the web server execute on your machine(client machine) by requesting web server through IE. If your requirement is anything like this then better use Citrix Presentation Server.

Having said that, if you want to execute any executable program from you web application then you can try below given code in you web page.
Note – the exe will run on the server machine not on the client and you would not get any GUI.

//C# code
ProcessStartInfo MyProcess = new ProcessStartInfo();
//path of the program exe file
MyProcess.FileName = @"c:\myprogram.exe";
//pass parameter if you’re executable require any command line argument
MyProcess.Arguments = @"anyparam";

Process.Start(MyProcess);

No comments: