Hi All,
using
System.Diagnostics;Process process =
new Process();process.StartInfo.FileName ="msimn.exe";
process.Start();
This code runs perfectly with Console Application but I need to run same " msimn.exe" on button's click event in web application..I have tried but unable to do that..
Pls..let me know how to do that ,Thanks in advance
Leena

How to launch process in c#.net web application(on button's click event)
JonasBergstrom
You could copy the file from the server share to a temp directory on the client machine, then execute it and delete it once execution has completed.
string strSourceFile = @"\\server\share\filename.exe";
string strDestinationFile = Environment.GetEnvironmentVariable("TEMP") + @"\filename.exe"
File.Copy(strSourceFile, strDestinationFile, true) // the true is a bool value to overwrite if exists
Process myProcess = new Process();
myProcess.Start(strDestinationFile);
myProcess.WaitForExit();
File.Delete(strDestinationFile);
I hope this helps you.
Nathan
anish77
Thanks the code snippet was helful for me
MichaelBrietzke
Leena,
iam trying to run a batch file from c# app.. it runs perfectly from console... but iam trying to make it a window service (the application is a file watcher) and now its not runing at all
any idea
Kabouter
We have the same issue. Our users have installed say program A, B and C locally and want to see icons for these programs on a page on our intranet. They want to click and start these programs from the icons instead of finding these programs in the start menu.
I once did this through an ActiveX component. What I didn't implement was a way to white list programs the component could start in case someone wanted to run format c: or something. So I removed it and I'am wondering how I can write a similar component, but this time in C#.
Cheers,
Kjell Inge
Sandeep Prabhakar
What are you trying to achieve Do you want to run the application on the client or server side
If its the former, you won't be able to do that as the Process code runs on the service side. If you are trying to start up Outlook Express for emailing purposes try using the mailto protocol, for example: mailto:mail@mydomain.com
If its the later, this is typically a very bad idea, imagine if a hundred users pushed the button at the same time; you have a very 'denial of service' attack waiting to happen.
Diego Canepa
I have taken example of outlook express...Actually we have some.exe which uninstalls some software which are no more required.
Right now we are manually running that exe, (& Do not want our end users to access that exe)
I want anybody who clicks the button on webpage, that exe should be run and uninstall respective software from that machine.
How to achieve this, is there any other way to do that
Thanks
Leena
J.H
Leena,
I'm still confused. From which computer should the application be uninstalled from The computer hosting the web page or the computer that is viewing the web page
Helen Cool Granny
Javeed
Hi Guys,
Got some how similiar link to solve problem i.e.
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=100749&SiteID=1,
but still donot know, How to run exe from client side on button's click event i.e computer that is viewing the web page
My exe is present on each and every client and Location where it resides is also same i.e C:\Program Files\xyz\.........
RS_babu
Hi Leen
I dont know if this is a good idea but one of the ways to do this is create a Managed C++ class that has a public function receiving a system command. In this public function you excute the system command by calling the C system() function. Compile this class to a DLL and reference this DLL from your C# application to call the Manages C++ public function directly. By doing this, you can activate your EXE from a button click.