如何ASPX和WinForms之间进行通信 [英] How to communicate between ASPX and WinForms
问题描述
我如何从一个ASPX页面发送命令WinForms应用程序?我们已经探索了执行不同的命令行参数的WinForms应用程序,但想要的东西更聪明。
How can I send commands to a WinForms application from an ASPX web page? We have already explored executing the WinForms application with different command line parameters but wanted something more smart.
感谢。
推荐答案
创建侦听HTTP GET
和/或 POST
命令和行为得体。然后使用AJAX来发送请求,即的http://本地主机/ MyApp的/命令=打印和放大器;文件= teletubies.jpg
Create a web server within your application that listens for HTTP GET
and/or POST
commands and acts appropriately. Then use AJAX to send request, i.e., http://localhost/myapp/?command=print&file=teletubies.jpg
您的Web服务器,这仅仅是一个监听端口80和发送响应根据非常简单的HTTP协议,你的应用程序中,然后解析请求的URL,并决定一个程序,它应该打印
文件 teletubies.jpg
基于URL查询字符串。
Your web server, which is just a program that listens on port 80 and sends responses according to the very simple HTTP protocol, within your application then parses the requested URL and decides that it should print
the file teletubies.jpg
based on the query string in the URL.
这篇关于如何ASPX和WinForms之间进行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!