在C#windows窗体应用程序中使用AJAX
问题描述:
是否有可能在C#windows窗体应用程序中使用AJAX。
Is it possible To use AJAX in C# windows form application.
答
问题似乎没有任何意义,这不是关于可能性或缺乏可能性。 Ajax一词与Javascript无关,而是其他内容: http://en.wikipedia.org/wiki/Ajax [ ^ ]。
如果你以某种方式在你的System.Windows.Forms
应用程序中托管了一些Javascript解释器和运行时系统,问题会有所帮助,但是很难相信:如果你工作的话在那种复杂程度上,很明显你可以使用Javascript提供的所有东西,包括Ajax,所以你不会问这样的问题。
相反,我怀疑您需要向某个站点或Web服务发送HTTP请求并接收HTTP响应。但这可以使用类System.Net.HttpWebRequest
来完成:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28v=vs.110 %29.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.net.webrequest(v = vs.110).aspx [ ^ ]。
当然这与System.Windows.Forms
或任何其他UI框架/库完全无关或任何特定的申请类型。-SA
The question does not seem to make any sense, and this is not about possibility or lack of possibility. The term Ajax is related to Javascript and nothing else: http://en.wikipedia.org/wiki/Ajax[^].
The question would make some sense if you somehow hosted some Javascript interpreter and runtime system in yourSystem.Windows.Forms
application, but it's hard to believe: if you worked at that level of sophistication, it would be apparent for you that you could use everything Javascript offers, including Ajax, so you would not ask such a question.
Rather, I suspect that you need to send an HTTP request to some site or Web service and receive HTTP response. But this can be done using the classSystem.Net.HttpWebRequest
:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.net.webrequest(v=vs.110).aspx[^].
And of course this is totally unrelated toSystem.Windows.Forms
or any other UI framework/library or any particular application type.—SA