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.

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

You can pass an array of integer to an ASP.NET Web Web API REST service by setting the [FromUri] attribute...
One of the common ways to refresh webpage every few mins is by using JavaScript or HTML Meta tag. For...
This post will provide the list of some of the top ASP.NET based Content Management Systems (CMS) that you may...