List out different return type of a controller action method? Manish Kumar1530409-May-2017.netmvc4 Updated on 23-Sep-2020
Manish Kumar
09-May-2017All return types are use to return results from controller to view.
base type of all result types is ActionResult.
ViewResult (View): It is used to return a webpage from an action method.
PartialviewResult (Partialview): It is used to send a part of a view which will be rendered in another view.
RedirectResult (Redirect): It is used to redirect to any other controller and action method depending on the URL.
RedirectToRouteResult (RedirectToAction, RedirectToRoute): It is used when we want to redirect to any other action method.
ContentResult (Content): It is used to return HTTP content type like text/plain as the result of the action.
jsonResult (json): It is used when we want to return a JSON message.
javascriptResult (javascript): It used to return JavaScript code that will run in browser.
FileResult (File): It is used to send binary output in response.
EmptyResult: It is used to return nothing (void) in the result.