是否可以使用c#中的命令行参数将值从Web应用程序发送到桌面应用程序 [英] Is it possible to send value from a web application to a desktop application using command line argument in c#

查看:77
本文介绍了是否可以使用c#中的命令行参数将值从Web应用程序发送到桌面应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用命令行参数在Web应用程序和桌面应用程序之间发送值?如果是,我们怎么做?

is it possible to send values between web application and desktop application using command line arguments??? if yes How can we do that?

推荐答案

请看Dave对这个问题的评论:没有意义。



发送假定通过网络发送。但Web应用程序只接收HTTP请求并发回HTTP响应。那就是说,当然你可以发送任何数据,但只能回到连接的客户端。如果连接的客户端是某个应用程序而不是浏览器,则可以将数据发回,为什么不呢?至于命令行参数......让我们看看。如果某个应用程序进程可以发送HTTP请求,则它已在运行。因此,它的命令行参数已经发送给它。忘记他们。因此,您只能将命令行参数传递给同一应用程序的第二个实例和任何其他进程的其他进程。但它会让整个构造变得如此疯狂......以为你不知道自己真正想要什么就更自然了。



的确,你总是需要激励你的问题,特别是如果你问的东西看起来很奇怪。



-SA
Please see Dave's comment to the question: it makes no sense.

"Send" assumes sending over the network. But the Web applications just receive HTTP requests and send back HTTP responses. That said, of course you can send any data, but only back to a connected client. If a connected client is some application and not a browser, you can send data back, why not? As to the command line parameters… let's see. If some application process can send an HTTP request, it is already running. Therefore, its command-line arguments are already sent to it. Forget them. So, you can only pass command-line arguments to some other process, of the second instance of the same application and any other. But it would make the whole construct so crazy that… it would be more natural to suggest that you simply don't know what you really want.

Indeed, you always need to motivate your question, especially if you are asking something seemingly weird.

—SA


通常,不,您不能从浏览器生成可执行文件。这对浏览器来说是一个巨大的安全漏洞。



如果您在受信任的网络中运行,则可以在IE中启动ClickOnce Windows窗体应用程序并将URL参数传递给它。如果应用程序受信任,则可以生成命令行程序,但用户通常会遇到其他安全问题。 (程序未安装,没有足够的权限运行等)在Internet区域中,ClickOnce应用程序将被沙箱太多,这可能不起作用。



像Sergey说的那样,命令行或Windows程序可以连接到提供Web应用程序的同一服务器,但它需要轮询服务器以获取更新,否则您将遇到客户端问题防火墙。这可能是可接受的客户端数量和流量,或者很容易使服务器基础设施过载。



需要考虑很多因素,更多信息将是有用的。
In general, no, you can not spawn an executable from a browser. That would be a huge security hole for a browser.

If you are running within a trusted network, it is possible to start a ClickOnce Windows Forms app in IE and pass URL parameters to it. If the app is trusted, it can then spawn command line programs, but there are often additional security issues for users. (program not installed, not enough privilege to run, etc.) In the Internet Zone, the ClickOnce app would be sandboxed too much, and this would probably not work.

Like Sergey said, it is possible for a command line or Windows program to be connected to the same server which delivers the web app, but it would need to poll the server for updates, otherwise you would have issues on the client side getting through firewalls. Depending on the number of clients and the amount of traffic this might be acceptable, or it could easily overload your server infrastructure.

There are a lot of considerations to think about, and more information would be useful.


这篇关于是否可以使用c#中的命令行参数将值从Web应用程序发送到桌面应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆