Call external program from ASP.NET

Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Mar 2006
Posts: 18
Reputation: mikefitz is an unknown quantity at this point 
Solved Threads: 0
mikefitz mikefitz is offline Offline
Newbie Poster

Call external program from ASP.NET

 
0
  #1
Sep 17th, 2006
Hi,
Does anyone know how to run an external program from ASP.NET.
The System.Diagnostics.Process or Shell() functions do not work for opening GUI applications like NotePad. I need my ASP.NET web form to open a Windows application that we be installed on the Client. Any ideas?

Thanks,
Mike
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 6
Reputation: leonpwhirl is an unknown quantity at this point 
Solved Threads: 0
leonpwhirl leonpwhirl is offline Offline
Newbie Poster

Re: Call external program from ASP.NET

 
0
  #2
Sep 22nd, 2006
I was able to get this to work using the
System.Diagnostics.Process. I did this by:

string fileLocation = @"filename";
Process test = new Process();
test.StartInfo.FileName = fileLocation;
test.Start();
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 100
Reputation: M_K_Higa is an unknown quantity at this point 
Solved Threads: 2
M_K_Higa's Avatar
M_K_Higa M_K_Higa is offline Offline
Junior Poster

Re: Call external program from ASP.NET

 
0
  #3
Sep 22nd, 2006
If you want to open an external app on the client, then asp.net won't help. Asp.net is server side. When using System.Diagnostics.Process, you can open external apps, but it opens on the web server, not the clients machine.

If you want to open an app, such as notepad, on the client machine, you need to use client side scripting such as javascript. NOTE: Most of the time, this won't work unless you lossen up the security, so it's very risky.

Anyway, here's a sample code to launch apps on the client.

  1. var theShell = new ActiveXObject("Shell.Application");
  2. var theApp = "C:\\Windows\\Notepad.exe";
  3. theShell.ShellExecute(theApp, "", "", "open", "1");
-Mike
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 18
Reputation: mikefitz is an unknown quantity at this point 
Solved Threads: 0
mikefitz mikefitz is offline Offline
Newbie Poster

Re: Call external program from ASP.NET

 
0
  #4
Sep 23rd, 2006
That will work just fine. Thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Call external program from ASP.NET

 
0
  #5
Sep 25th, 2006
That is really only suitable for an intranet application, and an IE-only browser environment.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 100
Reputation: M_K_Higa is an unknown quantity at this point 
Solved Threads: 2
M_K_Higa's Avatar
M_K_Higa M_K_Higa is offline Offline
Junior Poster

Re: Call external program from ASP.NET

 
0
  #6
Sep 26th, 2006
You are correct. This is more suitable for an intranet environment. Thanks for the clarification. I'd like to stress, even in an intranet environment, you still have to relax the security requirements a whole lot to make this work.
-Mike
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 95
Reputation: ManicCW is an unknown quantity at this point 
Solved Threads: 11
ManicCW's Avatar
ManicCW ManicCW is offline Offline
Junior Poster in Training

Re: Call external program from ASP.NET

 
0
  #7
Sep 27th, 2006
My little advice: Never mess with the client computer!
I hate when web pages try to do that.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 1
Reputation: tcornejo is an unknown quantity at this point 
Solved Threads: 0
tcornejo tcornejo is offline Offline
Newbie Poster

Re: Call external program from ASP.NET

 
0
  #8
Jun 25th, 2009
I put :

  1. <script language="javascript" >
  2.  
  3. function todo()
  4. {
  5. var theShell = new ActiveXObject("Shell.Application");
  6. var theApp = "C:\\Windows\\Notepad.exe";
  7. theShell.ShellExecute(theApp, "", "", "open", "1");
  8. }
  9. </script>

and then

<input type = "BUTTON" value = "Push Me!" name = "Command1" onclick="todo()">
but it doesnt seem to work

please helpme.
Last edited by peter_budo; Jun 26th, 2009 at 4:04 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC