DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   Call external program from ASP.NET (http://www.daniweb.com/forums/thread55365.html)

mikefitz Sep 17th, 2006 8:07 pm
Call external program from ASP.NET
 
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

leonpwhirl Sep 22nd, 2006 2:29 am
Re: Call external program from ASP.NET
 
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();

M_K_Higa Sep 22nd, 2006 7:25 pm
Re: Call external program from ASP.NET
 
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.

var theShell = new ActiveXObject("Shell.Application");
var theApp = "C:\\Windows\\Notepad.exe";
theShell.ShellExecute(theApp, "", "", "open", "1");

mikefitz Sep 23rd, 2006 1:46 pm
Re: Call external program from ASP.NET
 
That will work just fine. Thanks

tgreer Sep 25th, 2006 11:49 pm
Re: Call external program from ASP.NET
 
That is really only suitable for an intranet application, and an IE-only browser environment.

M_K_Higa Sep 26th, 2006 12:13 pm
Re: Call external program from ASP.NET
 
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.

ManicCW Sep 27th, 2006 8:13 am
Re: Call external program from ASP.NET
 
My little advice: Never mess with the client computer!
I hate when web pages try to do that.

tcornejo Jun 25th, 2009 7:14 pm
Re: Call external program from ASP.NET
 
I put :

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

and then

 <input type = "BUTTON" value = "Push Me!" name = "Command1" onclick="todo()">

but it doesnt seem to work

please helpme.


All times are GMT -4. The time now is 8:35 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC