ASP.NET MVC 4 / Web API - insert Razor renderer for Accepts: text/html

前端 未结 2 987
离开以前
离开以前 2021-02-15 17:40

I am creating a RESTful Web Service using ASP.NET MVC 4 Web API. For API access, I am returning JSON, though once I get everything working correctly, the content negotiation s

2条回答
  •  遥遥无期
    2021-02-15 17:59

    You might take a look at WebApiContrib.Formatting.Razor. It's very similar to Kyle's answer, however it's a full-blown open source project with more features, unit tests, etc. You can get it on NuGet as well.

    I will say it definitely needs more features, but they seem to have designed it well so it would be very easy to contribute to it.

提交回复
热议问题