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:
- ViewResult - Represents HTML and markup.Renders a specifed view to the response stream
- EmptyResult - Represents no result. An empty response is returned
- PartialViewResult - Renders a specifed partial view to the response stream
- RedirectResult - Represents a redirection to a new URL.Performs an HTTP redirection to a specifed URL
- RedirectToRouteResult - Performs an HTTP redirection to a URL that is determined by the routing engine, based on given route data
- ContentResult - Represents a text result.Writes content to the response stream without requiring a view.
- FileContentResult - Represents a downloadable file (with the binary content).Returns a file to the client.
- FilePathResult - Represents a downloadable file (with a path).Returns a file to the client.
- FileStreamResult - Represents a downloadable file (with a file stream).Returns a file to the client, which is provided by a Stream.