Developer Guide
Content Response

    You can generate any type of text-based content such as XML, Text, CSS or Javascript and pass that as the body of your response to an incoming HTTP request. Generally any type of content which is prepared inside the action method itself, without relying on the use of views, is to be used with this response model.

    public ActionResponse Index()
    {
         return Content("Hi, My name is Sam.");
    }
     
    Using the Content response, you can also set the following parameters:
     
    • Content(string content)
    • Content(string content, string contentType)
    • Content(string content, string contentType, Encoding contentEncoding)
     
    The contentType parameter allows you to specify a MIME type for your content. For more information, see .NET framework documentation on "Encoding" object.
     
    Note: If your action is returning any permissive type such as "String", "Integer", "Decimal", etc.,  Magentrix automatically converts the response to the Content response type and streams your action's results into the client's browser.
    public string MyAction()
    {
        return "<Contact><FirstName>Sam</FirstName></Contact>";
    }