Online: 6117
To output any content (plain text or HTML) from controller, we mark ContentResult as return type in the action method like below.
CONTROLLER CODE
public ContentResult OutputContent()
{
return Content("<strong>This is content.</strong>");
}
Notice that we are returning string content using the Content function by passing the data as string.
OUTPUT
POINT OF INTEREST
Play with few more overload methods of Content, they help us to pass the ContentType of the data we are returning and also Encoding used.