Windows应用程序与Web应用程序的对话 [英] Windows Application talk to Web Application ??

查看:77
本文介绍了Windows应用程序与Web应用程序的对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨:

我是ASP.net的新手,我希望Windows应用程序将命令发送到ASP.Net 2.0 Web应用程序以执行某些操作,无论是Web站点还是Windows在同一解决方案中应用或隔离。

如果它们在同一个解决方案中,如何使2个项目相互通信(Windows到Web反之亦然)


行动是 Windows应用程序告诉Web站点导航到文件夹中图像列表中的下一个图像


所以请帮助我任何事情:-(

谢谢

Hi:
I''m new at ASP.net, i want windows application to send commands to an ASP.Net 2.0 Web Application to perform certain action, either the Web-Site and Windows application within the same solution or isolated.
And if they were within the same solution, how to make 2 projects communicate with each other (Windows to Web not vice versa)

The action is " Windows Application tell the Web-Site to navigate to the next image in a list of images in a folder"

So please help me with anything :-(
Thank you

推荐答案

你可以做的是屏幕抓取web应用程序的超链接。

例如。如果网络页面包含按钮whit HREF< a href =" newpage.aspx?id = 5> Next< / a>

然后你应该让你的程序在新的浏览器窗口中加载这个页面/超链接您可以在浏览器控件中使用导航方法。

有关浏览器控件的更多信息,请参阅此链接:
http://ryanfarley.com/blog/archive/2004/12/23/1330.aspx
What you could do is "screen scrape" the web application for hyperlinks.
For example. If the web page contains a button whit HREF <a href="newpage.aspx?id=5>Next</a>
Then you should let your program load this page/hyperlink in a new browser window. You can use the "navigate" method in the browser control for this.
See this link for more info on the browser control:
http://ryanfarley.com/blog/archive/2004/12/23/1330.aspx


感谢您的回复,但我希望我的Windows应用程序能够触发下一个操作而不是网站用户。

问题是如何使Windows应用程序向ASP.Net Web应用程序发送内容。

我不希望Web站点最终用户导航或执行任何操作,控件来自My Windows Application。 br />
这是从Windows应用程序到Web应用程序的单播白板
Thank you for your reply, but i want my windows application to fire the next action not the Web-Site User.
The problem is how to make Windows Application send something to an ASP.Net web application.
I don''t want the Web-Site End-User navigate or do any thing, the control is from My Windows Application.
It''s a uni-cast whiteboard from Windows Application to Web-Application


hi。它真的取决于获取下一张图片的方式。在Web应用程序服务器中处理。


如果你可以通过更改网址来查看下一张图片,那么你就可以像阿诺德所说的那样做,并且只需控制你控制下的浏览器实例的当前网址Windows应用程序(例如通过浏览器控件)


如果只有在按下实际触发ASP.NET服务器中的某个事件的按钮后网站才会提供下一个图像然后给你得到的html,你需要的是用你的windows应用程序(system.sockets.tcpclient)连接到web服务器然后写一个合适的HTTP请求,用POST数据假装它是你的应用程序(而不是人工)按下按钮。


我会尝试进一步解释:当用户点击网页中的按钮时,可能就是按钮执行javascript代码,或者可能是按钮实际执行服务器中的代码(这取决于网站的设计方式等)。因此,如果您的按钮除了javascript代码之外什么都不做,您可以通过在Windows应用程序控制的浏览器实例中设置相应的URL来轻松获取下一个图像。如果按钮正在服务器中执行某些操作,那么您需要通过Windows应用程序提供HTTP POST请求,该请求看起来与人类用户单击按钮时生成的请求相同。


如果你处于第二种情况,我建议你练习程序curl,这样你就可以很容易地看到http请求的标题,这样你就可以调整你必须对网络应用程序发出的POST请求。如果你想使用curl,你可能需要安装cygwin或其他一些unix / linux模拟器。一旦你知道你需要发布的帖子请求,只需让你的Windows应用程序制作它,并让它将生成的Web服务器的响应重定向到从你的Windows应用程序控制的浏览器实例的html。


这有帮助吗?
hi. it really all depends on how "get next image" is handled in the web application server.

if you can get to the next image by changing the url, then you could do as Arnold says and just plain control the current url of the browser instance you have under your control in your windows application (by way of a browser control for example)

if the website will provide you the next image only after you push a button that actually fires some event in the ASP.NET server and then gives you the resulting html, what you need is to connect() to the web server with your windows app (system.sockets.tcpclient) then write an appropriate HTTP request, with POST data faking the fact that it''s your application (and not a human) pushing the button.

I''ll try to explain further: when a user clicks a button in a web page, it might be that the button just executes javascript code, or it might be that the button actually executes code in the server (it depends on how the website was designed, etc). so if your button is doing nothing but javascript code you can very easily get the next image by setting the appropriate url in the browser instance you control from your windows app. If the button is doing something in the server then you need to provide a HTTP POST request through your windows app that looks identical to the one generated when a human user clicks the button.

If you are in the second situation, I suggest you practice with program "curl", so you can easily see headers for http requests, so that you can tune the POST request you''ll have to make to the web app. You will probably need to install cygwin or some other unix/linux emulator if you want to use "curl". Once you know the post request you need to make, just have your windows app make it, and have it redirect the resulting web server''s response to the html of the browser instance controlled from your windows app.

Does this help?


这篇关于Windows应用程序与Web应用程序的对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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