What are main return types supported in Web API?

Technology CommunityCategory: ASP.NET Web APIWhat are main return types supported in Web API?
VietMX Staff asked 3 years ago

A Web API controller action can return following values:

  • Void – It will return empty content
  • HttpResponseMessage – It will convert the response to an HTTP message.
  • IHttpActionResult – internally calls ExecuteAsync to create an HttpResponseMessage
  • Other types – You can write the serialized return value into the response body