开发者

Simple server and client request/response in C#

OK. I just want to know if this can be done.

I'm using C# asp.net language.

I want to send a structure to a webserver from a webpage (much like you you can pass a structure to a function). The server would act on the data found in the structure, and开发者_运维知识库 then return back the structure (with its contents modified) to the "client" webpage. The webpage would then, based on the data received, do a particular task.

is it possible that information be passed between webpages & servers just like functions? If not, is there any way that i may be able to accomplish what was said above?


Answer is yes, you can try calling a server-side function from a client-side script.

Here are a few good reads:
Client-Side Web Service Calls with AJAX Extensions
Client Side Callbacks in ASP.NET 2.0
Extend ASP.NET AJAX Client-Side Function - The Server-Side Way
ASP.NET 2.0 Client-Side Features: Bring Server-Side Power to the Client


Sure. You can encode your structure in a string, and then send it to the server as a query string or in a form POST, using either a dedicated link or plain JavaScript or Ajax (XMLHTTP). When the response arrives, you can similarly decode it with JavaScript and then take whatever action is appropriate.

There are several libraries to help automate this kind of thing, including XML-RPC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜