WebMethod Response Format

I recently saw a jQuery example where POST was done in "Default.aspx / Test", where Test was WebMethod in Default.aspx, and the content type for the request was "application / json".

The response from WebMethod was in JSON. I always thought that WebMethods returns SOAP responses, but if I interpret this code correctly, as I said, WebMethod returns JSON.

It is right? Do WebMethods return a response in the format of the request content type? Since when is this possible? Is always? Or is it because I have ASP.NET AJAX installed? If so, what namespaces can I parse to see how this works?

I used only the WebMethods interface for .NET for .NET, which was in SOAP, and I always wrote my own response code in the correct format (SOAP, JSON or XML) based on the query string parameter of the request indicating the desired format. I always thought that WCF is required for this kind of meta-format functionality.

+3
source share
1 answer

This is the part ASP.NET AJAX. See For example Using Web Services in ASP.NET AJAX . Part of the AJAX client architecture is as follows:

- HTTP POST-. POST , , . . POST, GET. JSON POST . JSON .NET Framework -. , JavaScript .

+1

Source: https://habr.com/ru/post/1704426/


All Articles