How can I get a program on a client machine to run from an ASP.NET page?

I have an application that I am trying to run on an intranet. It worked perfectly on my machine (famous last words), but when I put it on the server, it didnโ€™t work. As soon as I saw the error "the system cannot find the specified file", I thought that it should be something with an attempt to run the program on the client machine.

Yes, it would be a security nightmare if any application in the browser could run the executable file on the client machine. Is this not the case for the intranet? Several computers on which it will work have the same version of IE and .NET on which it will work, and all of them must have the required .exe to run.

Here is an overview of the project:

  • The employee and participant enter the room containing the computer.
  • The employee opens my web application and looks for the person ID (this part works)
  • Clicking on โ€œrecordingโ€ should execute a hidden launch of an already installed program that will start recording.
  • Upon completion, the employee presses the completion button (or application timeout), and the file is saved.
  • The file is uploaded to the server.
  • Employees lack technical experience, so my goal is to pretty much have a website to go to where there is a little more than a mailbox to get a participant ID and two giant REC and STOP buttons

Can someone help me on how to do this (or at least let me know that this is not possible)?

+7
source share
4 answers

If you host your site in a trusted or intranet IE zone, the following Javascript will work just fine. I use this inside to associate our database search with a PC with our remote screen management software:

<script type="text/javascript" language="javascript"> function runDameWare(strHostname, blControl) { var objShell = new ActiveXObject("Wscript.Shell"); var strCommand = "C:\\Program Files\\Dameware\\dwrcc.exe -c: -h: -m:"; strCommand += strHostname; if (blControl) { strCommand += " -v:"; } objShell.Exec(strCommand); } </script> 

I understand that downloading the results of your work in a local program to a web server can be done using the HttpWebRequest class, as shown in this article:

http://forums.asp.net/p/1482778/3464854.aspx


Edit: This is how I call the function above. Basically, I just present a simple <a> element with an onclick attribute. There is probably a cleaner way to do this, but it works:

Markup:

 <asp:TemplateField> <ItemTemplate> <%# RenderDameWareLinks(Eval("ResourceName"))%> </ItemTemplate> </asp:TemplateField> 

the code:

 Protected Function RenderDameWareLinks(ByVal strHostname As String) As String Dim strFullLink As String = String.Empty Dim strViewLink As String = String.Empty strFullLink = "<a onclick=""runDameWare('" & strHostname & "', false);"">" strFullLink &= "<img alt=""Connect using DameWare"" src=""Image/dameware1.gif"" style=""padding: 2px;"" />" strFullLink &= "</a><br/>" strViewLink = "<a onclick=""runDameWare('" & strHostname & "', true);"">" strViewLink &= "<img alt=""Connect (View Only) using DameWare"" src=""Image/dameware2.gif"" style=""padding: 2px;"" />" strViewLink &= "</a>" Return strFullLink & strViewLink End Function 
+1
source

One idea: you can register a protocol handler to run the application with the required parameters.

+8
source

There are several ways to do this. One does not violate security (a lot).

You can upload a file with a specific file type. This type of file may be associated with the client program, so after clicking "ok" to download the file, the client program will be launched. The downloaded file may or may not contain some data, such as the identifier of some object.

An alternative would be to turn to ActiveX, which has security implications.

+3
source

Since the machine already needs to install this โ€œhiddenโ€ program, why not just write your own application and install it, and let the employee run it instead of your web application?

0
source

All Articles