Tuesday, September 2, 2008

Run Executable file in ASP.NET

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();


No comments: