MVC Controller Actions

A controller action returns something called an action result. An action result is what a controller action returns in response to a browser request.

You can see the methods of the controller base class

ActionResult is an abstract class that can have several subtypes. The ASP.NET MVC framework supports several types of action results including:

  1. ViewResult - Represents HTML and markup.Renders a specifed view to the response stream
  2. EmptyResult - Represents no result. An empty response is returned
  3. PartialViewResult - Renders a specifed partial view to the response stream
  4. RedirectResult - Represents a redirection to a new URL.Performs an HTTP redirection to a specifed URL
  5. RedirectToRouteResult - Performs an HTTP redirection to a URL that is determined by the routing engine, based on given route data
  6. JsonResult - Represents a JavaScript Object Notation result that can be used in an AJAX application.Serializes a given ViewData object to JSON format
  7. JavaScriptResult - Represents a JavaScript script.Returns a piece of JavaScript code that can be executed on the client.
  8. ContentResult - Represents a text result.Writes content to the response stream without requiring a view.
  9. FileContentResult - Represents a downloadable file (with the binary content).Returns a file to the client.
  10. FilePathResult - Represents a downloadable file (with a path).Returns a file to the client.
  11. FileStreamResult - Represents a downloadable file (with a file stream).Returns a file to the client, which is provided by a Stream.