如何使用Vb.Net代码从Windows应用程序连接到ASP.Net应用程序 [英] How to connect to ASP.Net Application from my Windows Application using Vb.Net Code
问题描述
朋友,
我已经使用Vb.Net代码创建了Windows应用程序.现在,我希望该桌面应用程序将字符串发送到ASP.Net应用程序并处理该请求,然后将其发送回桌面应用程序.是否可以将数据从Widows发送到Web App(始终存在提供的Internet连接).
我们怎样才能做到这一点?我们可以使用ASMX服务吗?这可能还是有其他方法?
实际要求是我将字符串发送到Web应用程序,该字符串将在Web应用程序中搜索该字符串,并将数据发送到桌面应用程序.
任何帮助,请
谢谢
Ganesh
Hi Friends,
I have created a Windows Application using Vb.Net code.Now I want that desktop app to send a String to the ASP.Net Application and Process the request and then it sent back to the desktop application. Is this possible that can we send the data from Widows to Web App (Provided Internet Connection is Present all the time ).
How can we achieve this? Can we do with a ASMX Service? Is this possible or is there any other way of doing?
Actual requirement is I will send a string to web app that will search the string in a web app and it will sends the data to desktop app.
Any Help, Please
Thanks
Ganesh
推荐答案
它与Windows应用程序或任何其他类型的桌面应用程序无关—没关系.您可以使用类System.Net.HttpWebRequest
:
进行操作 http://msdn.microsoft.com/en-us/library/system.net. httpwebrequest.aspx [ ^ ].
请同时参阅我过去的答案:
如何从另一个站点获取数据 [ ^ ],
从网页中获取特定数据 [ http://en .wikipedia.org/wiki/URI_scheme [ ^ ] )通过工厂方法( http://en.wikipedia.org/wiki/Factory_method_pattern [ ^ ])Create
,代码示例位于此处:
http://msdn.microsoft.com/en-us/library/system.net. webrequest.aspx [ ^ ].
—SA
It has nothing to do with Windows application, or any other kind of desktop application — it does not matter. You can do it using the classSystem.Net.HttpWebRequest
:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx[^].
Please see also my past answers:
How to get the data from another site[^],
get specific data from web page[^].
As the use ofSystem.Net.HttpWebRequest
is based on its base classSystem.Net.HttpWebRequest
; and the run-time type is determined during run time, based on the URI scheme (http://en.wikipedia.org/wiki/URI_scheme[^]) through it factory method (http://en.wikipedia.org/wiki/Factory_method_pattern[^])Create
, the code sample is available here:
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^].
—SA
这篇关于如何使用Vb.Net代码从Windows应用程序连接到ASP.Net应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!