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

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

You May Also Like

You can read connection string from web.config file in ASP.NET by using the ConfigurationManager class in case you want to...
When you deploy your ASP.NET Web Application on Windows Server running IIS , there are times that you might receive...
This post will explain how to resolve the error “Handler “aspNetCore” has a bad module “AspNetCoreModuleV2” in its module list”...