如何在客户端计算机上获取程序以从ASP.NET页面运行?

时间:2022-03-14 06:27:05

I have an app that I'm trying to run on an intranet. On my machine it worked great (famous last words) but when I put it up to the server, it didn't work. As soon as I saw the "the system cannot find the specified file" error, I figured it had to be something with trying to run a program that's on a client machine.

我有一个应用程序,我试图在Intranet上运行。在我的机器上它工作得很好(着名的遗言)但是当我把它放到服务器上时,它没有用。当我看到“系统找不到指定文件”错误时,我认为它必须是尝试运行客户端计算机上的程序。

Yes, it would be a security nightmare if any app in a browser could run an executable on a client machine. Is this any different for intranet? The few computers it would run on all have the same version of IE and .NET that it will run on, and they all have the required .exe to run.

是的,如果浏览器中的任何应用程序可以在客户端计算机上运行可执行文件,那将是一场安全噩梦。内联网有什么不同吗?它将运行的少数计算机具有与其运行的IE和.NET相同的版本,并且它们都具有运行所需的.exe。

Here's an overview of the project:

以下是该项目的概述:

  • An employee and a participant walk into a room containing a computer.
  • 员工和参与者走进包含计算机的房间。

  • The employee opens my web app and looks up the person's ID (this part works)
  • 员工打开我的网络应用程序并查找该人的ID(此部分有效)

  • Clicking on "record" should perform a hidden launch of an already-installed program, which begins recording.
  • 单击“记录”应执行已安装程序的隐藏启动,该程序开始记录。

  • When finished, the employee clicks finish (or the app times out) and the file is saved.
  • 完成后,员工单击完成(或应用程序超时)并保存文件。

  • File gets uploaded to server.
  • 文件上传到服务器。

  • The employees lack technical experience, so my objective is to pretty much have a website for them to go to where there is little more than a box to get the participant ID and two giant "RECORD" and "STOP" buttons
  • 员工缺乏技术经验,所以我的目标是为他们提供一个网站,只需一个盒子即可获得参与者ID和两个巨大的“RECORD”和“STOP”按钮

Can anyone help me out on how to do this (or at least let me know it's not feasible)?

任何人都可以帮我解决如何做到这一点(或者至少让我知道这是不可行的)?

4 个解决方案

#1


1  

If you put your site in the IE Trusted or Intranet zone, the following Javascript will work just fine. I use this one internally to link our PC support DB search to our remote screen control software:

如果您将您的网站放在IE Trusted或Intranet区域,以下Javascript将正常工作。我在内部使用这个将我们的PC支持数据库搜索链接到我们的远程屏幕控制软件:

<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>

My understanding is that uploading the results of your work in the local program to the web server can be accomplished using the HttpWebRequest class, as shown in this article:

我的理解是,可以使用HttpWebRequest类将本地程序中的工作结果上传到Web服务器,如本文所示:

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


Edit: This is how I call the above function. Basically I'm just rendering a plain <a> element with the onclick attribute. There's probably a cleaner way to do it, but it works:

编辑:这是我如何调用上述功能。基本上我只是使用onclick属性渲染一个普通的元素。可能有更简洁的方法,但它的工作原理:

Markup:

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

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

#2


8  

One idea: You can register a Protocol handler to launch your app with the required parameters.

一个想法:您可以注册协议处理程序以使用所需参数启动您的应用程序。

#3


3  

There are a couple of ways to do this. One doesn't violate security (much).

有几种方法可以做到这一点。一个人不违反安全(很多)。

You can download a file with a particular file type. That file type can be associated to the client program, so after clicking "ok" to download the file, the client program would launch. The downloaded file may or may not contain some data like the id of some object.

您可以下载具有特定文件类型的文件。该文件类型可以与客户端程序关联,因此在单击“确定”下载文件后,客户端程序将启动。下载的文件可能包含也可能不包含某些数据,如某些对象的ID。

The alternative would be to resort to ActiveX, which does have security implications.

另一种方法是使用ActiveX,它确实具有安全隐患。

#4


0  

Since the machine already needs to have this "hidden" program installed, why not just write a native application and install that and have the employee run that instead of your web application?

由于机器已经需要安装这个“隐藏”程序,为什么不只是编写一个本机应用程序并安装它并让员工运行而不是你的Web应用程序?

#1


1  

If you put your site in the IE Trusted or Intranet zone, the following Javascript will work just fine. I use this one internally to link our PC support DB search to our remote screen control software:

如果您将您的网站放在IE Trusted或Intranet区域,以下Javascript将正常工作。我在内部使用这个将我们的PC支持数据库搜索链接到我们的远程屏幕控制软件:

<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>

My understanding is that uploading the results of your work in the local program to the web server can be accomplished using the HttpWebRequest class, as shown in this article:

我的理解是,可以使用HttpWebRequest类将本地程序中的工作结果上传到Web服务器,如本文所示:

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


Edit: This is how I call the above function. Basically I'm just rendering a plain <a> element with the onclick attribute. There's probably a cleaner way to do it, but it works:

编辑:这是我如何调用上述功能。基本上我只是使用onclick属性渲染一个普通的元素。可能有更简洁的方法,但它的工作原理:

Markup:

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

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

#2


8  

One idea: You can register a Protocol handler to launch your app with the required parameters.

一个想法:您可以注册协议处理程序以使用所需参数启动您的应用程序。

#3


3  

There are a couple of ways to do this. One doesn't violate security (much).

有几种方法可以做到这一点。一个人不违反安全(很多)。

You can download a file with a particular file type. That file type can be associated to the client program, so after clicking "ok" to download the file, the client program would launch. The downloaded file may or may not contain some data like the id of some object.

您可以下载具有特定文件类型的文件。该文件类型可以与客户端程序关联,因此在单击“确定”下载文件后,客户端程序将启动。下载的文件可能包含也可能不包含某些数据,如某些对象的ID。

The alternative would be to resort to ActiveX, which does have security implications.

另一种方法是使用ActiveX,它确实具有安全隐患。

#4


0  

Since the machine already needs to have this "hidden" program installed, why not just write a native application and install that and have the employee run that instead of your web application?

由于机器已经需要安装这个“隐藏”程序,为什么不只是编写一个本机应用程序并安装它并让员工运行而不是你的Web应用程序?