Interview Question
Qus: What is diferent types of Action result in MVC?
The different types of Action Result in MVC are as follows -
1. ViewResult
This return type is used to return a webpage from an action method.
2. PartialViewResult
This return type is used to send a part of a view which will be rendered in another view.
3. JsonResult
This return type is used when we want to return a JSON message.
4. JavaScriptResult
This return type is used to return JavaScript code that will run in the browser.
5. EmptyResult
This return type is used to return nothing (void) in the result.
6. ContentResult
This return type is used to return HTTP content type like text/plain as the result of the action.
7. RedirectResult
This return type is used to redirect to any other controller and action method depending on the URL.
8. RedirectToRouteResult
This return type is used when we want to redirect to any other action method.
9. FileResult
This return type is used to send binary output in response.
1. ViewResult
This return type is used to return a webpage from an action method.
2. PartialViewResult
This return type is used to send a part of a view which will be rendered in another view.
3. JsonResult
This return type is used when we want to return a JSON message.
4. JavaScriptResult
This return type is used to return JavaScript code that will run in the browser.
5. EmptyResult
This return type is used to return nothing (void) in the result.
6. ContentResult
This return type is used to return HTTP content type like text/plain as the result of the action.
7. RedirectResult
This return type is used to redirect to any other controller and action method depending on the URL.
8. RedirectToRouteResult
This return type is used when we want to redirect to any other action method.
9. FileResult
This return type is used to send binary output in response.