简体   繁体   English

如何从aspx网页在客户端计算机上调用Win应用程序?

[英]How can I call a win app on client machine from my aspx web page?

I want to call a windows application on my clients machine from my aspx page , and If It's possible I want to send some parameter to the application . 我想从我的aspx页上的客户端计算机上调用Windows应用程序,如果可能,我想向该应用程序发送一些参数。 Any guids ? 有什么指导吗?

The only way you can do that is to custom-develop an ActiveX control and host that control in your page. 唯一的方法是自定义开发ActiveX控件并在页面中托管该控件。 Then the user would have to allow ActiveX controls in his browser. 然后,用户将不得不允许其浏览器中的ActiveX控件。 Normally, a browser is a sandbox, so you cannot access Windows from it... But with ActiveX, this is possible. 通常,浏览器是一个沙箱,因此您无法从其中访问Windows。但是使用ActiveX,这是可能的。

Here is a tutorial for developing ActiveX controls in C#: http://haseebakhtar.wordpress.com/2011/05/31/creating-an-activex-control-in-net-using-c/ 这是使用C#开发ActiveX控件的教程: http : //haseebakhtar.wordpress.com/2011/05/31/creating-an-activex-control-in-net-using-c/

Of course you can still use the old way, that is VB6 or C++... 当然,您仍然可以使用旧的方式,即VB6或C ++。

You may use Shell API in javascript to invoke your windows application. 您可以在JavaScript中使用Shell API来调用Windows应用程序。 This works only in Internet explorer browser. 这仅在Internet Explorer浏览器中有效。 You need to make sure that your browser security settings (At client) is also changed to " run activex controls " 您需要确保将浏览器的安全设置(在客户端)也更改为“ 运行Activex控件

Here is a sample. 是一个样本。

I don't know the specific details, but this might point you in the right direction. 我不知道具体细节,但这可能会为您指明正确的方向。

For instance, some IRC applications react when you click a link whose target is irc://some.host.com 例如,某些IRC应用程序在您单击目标为irc://some.host.com的链接时会做出反应。

Same goes for textmate application for mac: Mac的Textmate应用程序也是如此:

txmt://open?«arguments»

This, however, is only possible if the target application has registered a custom URL schema in the user's machine. 但是,只有在目标应用程序已在用户计算机中注册了自定义URL架构的情况下才有可能。 Furthermore, the User has to allow access to it. 此外,用户必须允许访问它。

You could write a ClickOnce application that you can launch from the web page. 您可以编写一个可以从网页启动的ClickOnce应用程序。

If you make it a full-trust application, you can use it to launch the local Windows application. 如果使它成为完全信任的应用程序,则可以使用它来启动本地Windows应用程序。 You can pass arguments to the ClickOnce application, which can parse them and pass them on to the local Windows application. 您可以将参数传递给ClickOnce应用程序,该应用程序可以解析它们并将其传递给本地Windows应用程序。

Alternatively, if you are the author of the local Windows application (and if it is C#/.Net) then you could make the Windows application itself a ClickOnce application. 另外,如果您是本地Windows应用程序的作者(如果是C#/。Net),则可以使Windows应用程序本身成为ClickOnce应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM