home / software / tips and tricks / What is the diffrece between ActionResult and ViewResult?

What is the diffrece between ActionResult and ViewResult?

Updated:  10/21/2013 06:10 AM
Author:  Shiju Mathews

Status:    Resolved.


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

  • ActionResult is an abstract class, and it's base class for ViewResult class.

  • In MVC framework, it uses ActionResult class to reference the object your action method returns. And invokes ExecuteResult method on it.




    The following are the derived class from ActionResult.

  • System.Web.Mvc.ContentResult: Represents a user-defined content type that is the result of an action method.

  • System.Web.Mvc.EmptyResult:Represents a result that does nothing, such as a controller action method that returns nothing.

  • System.Web.Mvc.FileResult: Represents a base class that is used to send binary file content to the response.

  • System.Web.Mvc.HttpStatusCodeResult:Provides a way to return an action result with a specific HTTP response status code and description.

  • System.Web.Mvc.JavaScriptResult: Sends JavaScript content to the response.

  • System.Web.Mvc.JsonResult:Represents a class that is used to send JSON-formatted content to the response.

  • System.Web.Mvc.RedirectResult:Controls the processing of application actions by redirecting to a specified URI.

  • System.Web.Mvc.RedirectToRouteResult:Represents a result that performs a redirection by using the specified route values dictionary.

  • System.Web.Mvc.ViewResultBase: Represents a base class that is used to provide the model to the view and then render the view to the response.


    For more details please refer ActionResult Class
  • Tags: What is the diffrece between ActionResult and ViewResult?
    Updated on: November 2024