Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are all the available ActionResults for ASP.NET MVC?

What are all the methods that return an ActionResult in ASP.NET MVC as of right now (ie. RedirectToAction, etc.)

I haven't found a good documentation resource that lists this kind of stuff.

like image 222
KingNestor Avatar asked Jun 17 '09 15:06

KingNestor


People also ask

How many Actionresults are there in MVC?

There are two methods in Action Result. One is ActionResult() and another one is ExecuteResult().

How many types of filters are there in MVC?

The ASP.NET MVC framework supports four different types of filters: Authorization filters – Implements the IAuthorizationFilter attribute. Action filters – Implements the IActionFilter attribute. Result filters – Implements the IResultFilter attribute.

What are the different types of action result?

As you can see, there are three categories of data types of ActionResult, Content Returning Results. Redirection Results.


2 Answers

Found from here

System.Web.Mvc.ActionResult
    System.Web.Mvc.ContentResult
    System.Web.Mvc.EmptyResult
    System.Web.Mvc.FileResult
    System.Web.Mvc.HttpUnauthorizedResult
    System.Web.Mvc.JavaScriptResult
    System.Web.Mvc.JsonResult
    System.Web.Mvc.RedirectResult
    System.Web.Mvc.RedirectToRouteResult
    System.Web.Mvc.ViewResultBase

Methods on the controller object are here

There is:

Content
File
Javascript
Json
PartialView
Redirect
RedirectToAction
RedirectToRoute
View
like image 197
Jake Avatar answered Nov 14 '22 06:11

Jake


From ActionResult types in MVC2:

  • ContentResult – Represents a text result.

  • EmptyResult – Represents no result.

  • FileContentResult – Represents a downloadable file (with the binary content).

  • FilePathResult – Represents a downloadable file (with a path).

  • FileStreamResult – Represents a downloadable file (with a file stream).

  • JavaScriptResult – Represents a JavaScript script.

  • JsonResult – Represents a JavaScript Object Notation result that can be used in an AJAX application.

  • PartialViewResult – Represents HTML and markup rendered by a partial view.

  • RedirectResult – Represents a redirection to a new URL.

  • RedirectToRouteResult – Represents a result that performs a redirection by using the specified route values dictionary.

  • ViewResult – Represents HTML and markup rendered by a view.

like image 40
Raj Kaimal Avatar answered Nov 14 '22 06:11

Raj Kaimal