What Are different return types of a controller action method in MVC?
The types of controller action methods -
1. ViewResult – It is used to renders a specified view to the response stream
2. PartialViewResult – It is used to renders a specified partial view to the response stream
3. EmptyResult - It is used to returns an empty response
4. RedirectResult - It is used to performs an HTTP redirection to a specified URL
5. RedirectToRouteResult - It is used to performs an HTTP redirection to a URL that is determined by the routing engine, based on given route data
6. JsonResult - It is used to serializes a given object to JSON format
7. JavaScriptResult - It is used to returns a piece of JavaScript code that can be executed on the client
8. ContentResult - Writes content to the response stream without requiring a view
9. FileContentResult - It is used to returns a file to the client
10. FileStreamResult - It is used to returns a file to the client, which is provided by a Stream
11. FilePathResult - It is used to returns a file to the client
You can see how controller action methods works
as following-
I hope you are enjoying with this post! Please share with you friends. Thank you!!