I have a asp.net MVC razor C# application which has 1 controller and 1 POST function which accepts a parameter. And the function returns a HttpResponseMessage.
You're mixing up WebAPI and MVC.
For WebAPI, the HttpResponseMessage
(with Content = new StringContent("the string")
) would work.
For MVC, the syntax to return a string is (note the ActionResult
return type and Content()
call):
public ActionResult Test()
{
return Content("This is my output");
}