Interviews - C# Corner

Rajesh Gami
List out different return types of a controller action method?
By Rajesh Gami in .NET onApr 14 2018
  • Rajesh Gami
    Apr, 2018 14

    There are total nine return types we can use to return results from controller to view.The base type of all these result types isActionResult.ViewResult (View): This return type is used to return a webpage from an action method.PartialviewResult (Partialview): This return type is used to send a part of a view which will be rendered in another view.RedirectResult (Redirect): This return type is used to redirect to any other controller and action method depending on the URL.RedirectToRouteResult (RedirectToAction, RedirectToRoute): This return type is used when we want to redirect to any other action method.ContentResult (Content): This return type is used to return HTTP content type like text/plain as the result of the action.jsonResult (json): This return type is used when we want to return a JSON message.javascriptResult (javascript): This return type is used to return JavaScript code that will run in browser.FileResult (File): This return type is used to send binary output in response.EmptyResult: This return type is used to return nothing (void) in the result.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS