How i return data in html format in web api??
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Midhun TpRank #388 · 6.5K reputationPosted Aug 12, 2016, 9:06 PM EDT
Vinay SinghRank #604 · 4K reputationPosted Aug 12, 2016, 10:03 PM EDT
Return HTML string
Return string content with media type
text/html:Returning Razor view from Web API
You need to
Install-Package RazorEngineusing your NuGet console.Now we can use code from the previous example to return HTML string from Web API.