Run Executable file in ASP.NET

In this blog post, i will provide a code snippet of how to run a process (in this case it is WindowsMediaPlayer.exe) which exists in your application root folder.

// Create An instance of the Process class responsible for starting the newly process.

System.Diagnostics.Process process1 = new System.Diagnostics.Process();

// Set the directory where the file resides

process1.StartInfo.WorkingDirectory = Request.MapPath("~/");

// Set the filename name of the file you want to open

process1.StartInfo.FileName = Request.MapPath("WindowsMediaPlayer.exe"); 

// Start the process

process1.Start();

 

 

Hope this helps,

Comments

# re: Run Executable file in ASP.NET

Monday, April 23, 2007 6:25 AM by shakil ahmed

your article is very good.

but we want more information about how to call  exe in web form b'coz

i want to convert video file to flv using converter(using exe file).

so plz reply as soon as possible

                                                         thanks

# re: Run Executable file in ASP.NET

Wednesday, September 05, 2007 2:09 PM by Alexei

Thank you very much!!!

# re: Run Executable file in ASP.NET

Wednesday, October 24, 2007 1:44 PM by Curtis

Has this been answered yet?

# re: Run Executable file in ASP.NET

Sunday, November 18, 2007 9:32 AM by Nandkishore

Hi,

Can you please tell me how can I call Outlook Express mail utility using asp.net web form?

Thanks & Regards,

Nandkishore

# re: Run Executable file in ASP.NET

Wednesday, December 19, 2007 1:47 AM by Darshan ATwal

you can call any local exe from webpage(asp.net) using javascript because it always runs on client side.

I hope it will be helpfull to you,

thanks

# re: Run Executable file in ASP.NET

Wednesday, January 30, 2008 1:49 AM by Ihab

hiHissam

thanks for this fruitfull article

but I wrote code to run txt file and it is working on the server it self using http://localhost

but when i tried to run from client using http://servername

nothing appears

this is the code

ProcessStartInfo processStartInfo = new ProcessStartInfo();

       processStartInfo.FileName = @"c:\WINDOWS\system32\notepad.exe";

       processStartInfo.Arguments = @"c:\test.txt";

       Process.Start(processStartInfo);

# re: Run Executable file in ASP.NET

Tuesday, February 12, 2008 5:49 AM by bhupesh

execute exe

# re: Run Executable file in ASP.NET

Friday, March 14, 2008 5:42 AM by haissam

Ihab Make sure that ASPNET account (WINDOWS 2000/XP) has right permission on the folder containing the exe file you want to execute and the location of the file you want to open. But i'm not sure what you are trying to do in your case. Give me more details to help you more.

# dvdclone

Tuesday, April 29, 2008 12:00 AM by dvdclone

Gosh provides an alternate way to run command- line Groovy scripts, as well as a simplified way to write Windows Services ( WinNT Services ) using Groovy. Gosh treats scripts the same, whether they are run from the command- line or as a service (including

# re: Run Executable file in ASP.NET

Tuesday, September 02, 2008 4:45 PM by mxdev

I have similar problem to run application on server side

and i solved it like this:

1. change local policies for APSNET user:

in WinXP: run secpol.msc

go to Local Policies->User Rights Assignment

find "Deny log on locally" and remove ASPNET user from it.

then find "Deny logon locally" and remove ASPNET user from it.

after that this code  will work

ProcessStartInfo processStartInfo = new ProcessStartInfo();

      processStartInfo.FileName = @"c:\WINDOWS\system32\notepad.exe";

      processStartInfo.Arguments = @"c:\test.txt";

      Process.Start(processStartInfo);

more details:

mxdev.blogspot.com/.../asp-net-run-application-exe-from-aspnet.html

Developer Blog - Mxdev - Personal Blog of Max Ivak; IT Management, Software development, Databases, Web solutions, Database optimization

# re: Run Executable file in ASP.NET

Tuesday, September 02, 2008 5:05 PM by mxdev

1. change local policies for APSNET user:

in WinXP: run secpol.msc

go to Local Policies->User Rights Assignment

find "Deny log on locally" and remove ASPNET user from it.

then find "Deny logon locally" and remove ASPNET user from it.

2. Security for files.

if your application needs also to work with files (open, save, etc) you have to change security settings for the folders to allow user ASPNET modify nedeed files.

to do this:

- In Explorer right button mouse click the folder and select "Properties"

- In Security tab, add "ASPNET" in and give desired permissions (Read, Write, Execute, etc).

# re: Run Executable file in ASP.NET

Wednesday, September 03, 2008 1:55 AM by haissam

mxdev thanks for sharing your information!

The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.