How to return in Web API?MKMohsin Khan7yAsked Feb 6, 2019, 11:04 PM EST5 answersShareLinkedInXCopy linkSave string strForm = PreparePOSTForm(action, data); Page.Controls.Add(new LiteralControl(strForm));
How to return in Web API?MKMohsin Khan7yAsked Feb 6, 2019, 11:04 PM EST5 answersShareLinkedInXCopy linkSave string strForm = PreparePOSTForm(action, data); Page.Controls.Add(new LiteralControl(strForm));
Salman BegRank #284 · 8.8K reputation7y agoPosted Feb 6, 2019, 11:45 PM EST0Hi. You can follow this article for return types, https://www.c-sharpcorner.com/article/types-of-web-api-action-results/ . Thanks.0
Mageshwaran RRank #411 · 6.1K reputation7y agoPosted Nov 18, 2019, 5:55 AM EST0Hi,please refer this link:https://stackoverflow.com/questions/44387494/c-sharp-net-web-api-return-from-post-request 0
Dipa MehtaRank #361 · 6.9K reputation7y agoPosted Nov 18, 2019, 6:20 AM EST0A Web API controller action can return any of the following: void HttpResponseMessage IHttpActionResult Some other type Depending on which of these is returned, Web API uses a different mechanism to create the HTTP response. for more details: https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/action-results refer this link. 0
Arun Kumar TiwariRank #3,157 · 454 reputation7y agoPosted Nov 18, 2019, 7:26 PM EST0It depends on which type you want to return through web API. There are the following types of returns in Web API. VoidHttpResponseMessageIHttpActionResultSome other typeFor more details plz check out the below link. https://stackoverflow.com/questions/44387494/c-sharp-net-web-api-return-from-post-request 0Nirmal DayalRank #1,712 · 886 reputation7y agoPosted Nov 18, 2019, 9:29 PM EST0Hi Mohsin, VoidAny Entity/DatatypeHttpResponseMessage - When Web API return type is HttpResponseMessage, Web API converts the return value directly into an HTTP response message.IHttpActionResult - HttpActionResult is introduced in Web API 2, IHttpActionResult interface acts like a factory for HttpResponseMessage. 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nirmal DayalRank #1,712 · 886 reputation7y agoPosted Nov 18, 2019, 9:29 PM EST0Hi Mohsin, VoidAny Entity/DatatypeHttpResponseMessage - When Web API return type is HttpResponseMessage, Web API converts the return value directly into an HTTP response message.IHttpActionResult - HttpActionResult is introduced in Web API 2, IHttpActionResult interface acts like a factory for HttpResponseMessage. 0
Salman BegRank #284 · 8.8K reputationPosted Feb 6, 2019, 11:45 PM EST
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 18, 2019, 5:55 AM EST
Dipa MehtaRank #361 · 6.9K reputationPosted Nov 18, 2019, 6:20 AM EST
A Web API controller action can return any of the following:
Arun Kumar TiwariRank #3,157 · 454 reputationPosted Nov 18, 2019, 7:26 PM EST
Nirmal DayalRank #1,712 · 886 reputationPosted Nov 18, 2019, 9:29 PM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts