top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Name a few different return types of a controller action method?

+3 votes
209 views
Name a few different return types of a controller action method?
posted Oct 14, 2015 by Shivaranjini

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

There are total nine return types we can use to return results from controller to view.

-The base type of all these result types is ActionResult.

  1. ViewResult (View) : This return type is used to return a webpage from an action method.

  2. PartialviewResult (Partialview) : This return type is used to send a part of a view which will be rendered in another view.

  3. RedirectResult (Redirect) : This return type is used to redirect to any other controller and action method depending on the URL.

  4. RedirectToRouteResult (RedirectToAction, RedirectToRoute) : This return type is used when we want to redirect to any other action method.

  5. ContentResult (Content) : This return type is used to return HTTP content type like text/plain as the result of the action

  6. jsonResult (json) : This return type is used when we want to return a JSON message.

  7. javascriptResult (javascript) : This return type is used to return JavaScript code that will run in browser.

  8. FileResult (File) : This return type is used to send binary output in response.

  9. EmptyResult : This return type is used to return nothing (void) in the result.

answer Oct 15, 2015 by Manikandan J
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...