bnil
bnil

Reputation: 1541

Want to understand the concept of ActionResult in MVC.

I am new to MVC development.

I am trying to figure out about ActionResult.

I have go to many links on this forum itself... but I don't think anyone give clear answer...

I have read many answers like ViewResult is derived from ActionResult and Rendering thing...

but Boss, What exactly ActionResult is ?

We know the return types like string, double,int but what exactly ActionResult is ? What it returns ?

Can anyone tell me in simple manner ?

Upvotes: 2

Views: 2087

Answers (1)

evevffv
evevffv

Reputation: 446

Encapsulates the result of an action method and is used to perform a framework-level operation on behalf of the action method.

The Action Result in ASP.NET MVC provides a simple and versatile means of returning different types of response to the browser.

It's an abstract class that returns following SubTypes

  • ViewResult

  • PartialViewResult

  • EmptyResult

  • RedirectResult

  • RedirectToRouteResult

  • JsonResult

  • JavaScriptResult

  • ContentResult

  • FileContentResult

  • FileStreamResult

  • FilePathResult

What do you want to return ?

View ? partial View ? Some Json String ? File response the client ?

Upvotes: 2

Related Questions