How to return a string as result from a Controller in ASP.NET MVC 4 Application ?

Do you want to return a string as result from a Controller in ASP.NET MVC 4 Application ? If Yes , you can use return the ContentResult instead of the actual view/partial view.

How to return a string as result from a Controller in ASP.NET MVC 4 Application ?

public ActionResult Index() {

return Content("Ginktage.com is a technology and programming blog");

}

In the above example , the ContentResult is returned as plain text.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply