Tell me different return types of a controller action method?
Submitted by: MuhammadThere are total nine return types we can use to return results from controller to view.
☛ 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.
Submitted by: Muhammad
☛ 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.
Submitted by: Muhammad
Read Online MVC Developer Job Interview Questions And Answers
Top MVC Developer Questions
☺ | Tell me in which assembly is the MVC framework is defined? |
☺ | Explain what are Filters in MVC? |
☺ | Tell us attribute based routing in MVC? |
☺ | Suppose if we have multiple filters, what’s the sequence for execution? |
☺ | Tell us what are the Difference between ViewBag&ViewData? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |