Name types of Action Results in Web API 2

Technology CommunityCategory: ASP.NET Web APIName types of Action Results in Web API 2
VietMX Staff asked 3 years ago

A Web API controller action can return any of the following:

  • void – Return empty 204 (No Content)
  • HttpResponseMessage – Return empty 204 (No Content)
  • IHttpActionResult – Call ExecuteAsync to create an HttpResponseMessage, then convert to an HTTP response message
  • Some other type – Write the serialized return value into the response body; return 200 (OK).