Types of action results
ActionResult Return Type
You can create action methods that return an object of any type, such as a string, an integer, or a Boolean value. These return types are wrapped in an appropriate ActionResult type before they are rendered to the response stream.
The following table shows the built-in action result types and the action helper methods that return them.
ActionResult | Helper Method | Description |
ViewResult | View | Renders a specifed view to the response stream |
PartialViewResult | PartialView | Renders a specifed partial view to the response stream |
EmptyResult | (None) | An empty response is returned |
RedirectResult | Redirect | Performs an HTTP redirection to a specifed URL |
RedirectToRouteResult | RedirectToRoute | Performs an HTTP redirection to a URL that is determined by the routing engine, based on given route data |
JsonResult | Json | Serializes a given ViewData object to JSON format |
JavaScriptResult | JavaScript | Returns a piece of JavaScript code that can be executed on the client |
ContentResult | Content | Writes content to the response stream without requiring a view |
FileContentResult | File | Returns a file to the client |
FileStreamResult | File | Returns a file to the client, which is provided by a Stream |
FilePathResult | File | Returns a file to the client |