The action of the ASP. NET MVC and Web API is very different from getting the data that is passed in from the foreground
The foreground uses Ajax to initiate post requests to the background Content-type:application/json
Use the following JSON object
{ "user": { "Username": "XXX", "Password": "xxxx" }}
{ "Username": "XXX", "Password": "XXX" }
Public string Login (user user) { try { sign.login (user); } Catch (loginexception e) { return e.message; } // Save Login Status true ); return "Success"; }
In MVC, both formats can be used to obtain the user's Username,password,
In Webapi, using the first one to get to the user's Username,password is null, the second can get to the user's Username,password.
In MVC
Public ActionResult Test (intint int c) { return View (); }
This Aciton can pass a JSON like this.
{ "a": 1, "B": 2, "C": 3}
Using this parameter in Webapi, you will be prompted not to find the configured action, perhaps Webapi can only define parameters of the reference type in addition to the ID defined in the route (using the URL parameter), and
{ "Username": "XXX", "Password": "XXX" }
The JSON in this format is passed in to receive.
The difference between [ASP] MVC and Web APIs