What are the sub types of ActionResult
Andrew White
Published Apr 18, 2026
ViewResult – Renders a specified view to the response stream.PartialViewResult – Renders a specified partial view to the response stream.EmptyResult – An empty response is returned.RedirectResult – Performs an HTTP redirection to a specified URL.
What are different types of ActionResult in MVC 4?
- ViewResult.
- PartialViewResult.
- ContentResult.
- EmptyResult.
- FileResult.
- JsonResult.
- JavaScriptResult.
What is ActionResult return type in MVC?
An ActionResult is a return type of a controller method in MVC. Action methods help us to return models to views, file streams, and also redirect to another controller’s Action method.
What are the different types of action result?
- View Result.
- Partial View Result.
- Redirect Result.
- Redirect To Action Result.
- Redirect To Route Result.
- Json Result.
- File Result.
- Content Result.
How many types of results are there in MVC?
there are 13 types of results , including return file , return file result , return partial view , return content , return content result etc.
What is difference between ActionResult and ViewResult?
3 Answers. ActionResult is base type while ViewResult is subtype of ActionResult . When you set Action’s return type ActionResult , you can return any subtype of it e.g Json,PartialView,View,RedirectToAction.
What are ActionResult in MVC?
What is an ActionResult? An ActionResult is a return type of a controller method, also called an action method, and serves as the base class for *Result classes. Action methods return models to views, file streams, redirect to other controllers, or whatever is necessary for the task at hand.
What is ActionResult abstract class or concrete class?
ActionResult is an abstract class that represents the result of an action method.What are the action methods?
- All the public methods in the Controller class are called Action methods.
- The Action method has the following restrictions. …
- ActionResult is a base class of all the result type which returns from Action method.
- ViewResult.
- PartialViewResult.
- ContentResult.
- RedirectResult.
- RedirectToRouteResult.
- JsonResult.
- EmptyResult.
- FileResult.
What is the difference between ActionResult and JsonResult?
Use JsonResult when you want to return raw JSON data to be consumed by a client (javascript on a web page or a mobile client). Use ActionResult if you want to return a view, redirect etc to be handled by a browser. ActionResult is an abstract class . JsonResult is subtype of ActionResult .
What is ActionResult in Web API?
Leverage action results to return data as an HttpResponseMessage object from your Web API controller method. ASP.Net Web API is a lightweight framework used for building stateless and RESTful HTTP services. You can take advantage of Action Results in Web API to return data from the Web API controller methods.
How many types of routing are there in MVC?
There are two types of routing (after the introduction of ASP.NET MVC 5). Convention based routing – to define this type of routing, we call MapRoute method and set its unique name, url pattern and specify some default values.
How many types of results are there in MVC Mcq?
There are 12 types of results in MVC.
What is AuthConfig Cs in MVC?
When you create an MVC 4 web application with the Internet Application template, the project is created with a file named AuthConfig. cs in the App_Start folder. The AuthConfig file contains code to register clients for external authentication providers.
Can ActionResult return JSON?
Some action result types are specific to a particular format, such as JsonResult and ContentResult. Actions can return results that are formatted in a particular format, regardless of client preferences. For example, returning JsonResult returns JSON-formatted data.
What is the difference between ActionResult and IHttpActionResult?
IHttpActionResult is for ASP.NET Web Api, while IActionResult is for ASP.NET Core. There’s no such thing as “Web Api” in ASP.NET Core. It’s all just “Core”. However, some people still refer to creating an ASP.NET Core API as a “Web Api”, which adds to the confusion.
What is the use of TempData in MVC?
TempData is used to transfer data from view to controller, controller to view, or from one action method to another action method of the same or a different controller. TempData stores the data temporarily and automatically removes it after retrieving a value. TempData is a property in the ControllerBase class.
What is the difference between TempData ViewData and ViewBag in MVC?
To summarize, ViewBag and ViewData are used to pass the data from Controller action to View and TempData is used to pass the data from action to another action or one Controller to another Controller.
What is ActionResult C#?
The ActionResult method works as a return type of any controller method in the MVC. It acts as the base class of Result classes. It is used to return the models to the Views, file streams, and also redirect to the controllers. It is the responsibility of the Controller that connects the component.
What is the difference between view and partial view?
View can basically contains a complete markup which may contain a master view(or master page) with all the design(s) etc. whereas Partial view is only a portion of page or a small markup which don‘t have master page. It is basically used as user control in mvc and it can be used at more than one views.
What are the three segments that are important for routing?
The three segments of a default route contain the Controller, Action and Id.
Can we have two action methods with same name in MVC?
While ASP.NET MVC will allow you to have two actions with the same name, . NET won’t allow you to have two methods with the same signature – i.e. the same name and parameters. You will need to name the methods differently use the ActionName attribute to tell ASP.NET MVC that they’re actually the same action.
What is MVC method?
What is the Action Method in MVC 5. ASP.NET MVC action methods are responsible to execute the request and generate a response to it. All the public methods of the MVC Controller are action methods. If we want the public method to be a non-action method, then we can decorate the action method by “NonAction” attribute.
What is ViewResult concrete class?
What is ViewResult() ? ViewResult() renders a specifed view to the response stream. ViewResult() is a concrete class. ViewResult() is a derived class of ActionResult() ViewResult is an implementation for this abstract class (ActionResult class).
What is bundling and minification in MVC with example?
Bundling and minification are two techniques you can use in ASP.NET to improve page load performance for your web application. Bundling combines multiple files into a single file. Minification performs a variety of different code optimizations to scripts and CSS, which results in smaller payloads.
Which of the following are Actionselectors?
- NonAction.
- ActionName.
- ActionVerbs.
What are the return types in Web API?
- Void.
- Primitive type or Complex type.
- HttpResponseMessage.
- IHttpActionResult.
What is JsonRequestBehavior?
By default, the ASP.NET MVC framework does not allow you to respond to an HTTP GET request with a JSON payload. If you need to send JSON in response to a GET, you’ll need to explicitly allow the behavior by using JsonRequestBehavior. AllowGet as the second parameter to the Json method.
Which ActionResult support in asp net web API?
The IHttpActionResult action result was introduced in Web API 2. It also returns the HttpResponseMessage. But the code we write to send the HTTP Response Message will be reduced with this interface.
What is difference between IHttpActionResult and HttpResponseMessage?
In Web API 2, IHttpActionResult comes as a new feature which is basically the replacement of HttpResponseMessage. It creates a clean code and allows extensibility of the type of response that we create. Advantages of using the IHttpActionResult: It simplifies unit testing of controllers.