Briefly explain me about what is Action Result with its different types with example.
What is Action Result with its types.
27128-Jan-2020
Updated on 28-Jan-2020
Home / DeveloperSection / Forums / What is Action Result with its types.
Briefly explain me about what is Action Result with its different types with example.
Nishi Tiwari
28-Jan-2020The ActionResult in asp.net mvc is an Abstract class and ActionResult is return type of controller method. Each ActionResult return different type of result depending upon the condition. If we want to display image in Webforms then we need to create Imagehandler for this but in Asp.net MVC we can use FileResult which is already built in method.
ActionResult is the base class for all the result type action method.
Whenever we create an empty controller in MVC we have by default ActionResult method created with name Index and which returns View() but we do not have only Return View() option but also various other options.
Types of Action Results in Asp.Net MVC
1. ContentResult
2. EmptyResult
3. FileResult
4. JavaScriptResult
5. JsonResult
6. PartialViewResult
7. RedirectResult
8. RedirectToRouteResult
9. ViewResult