Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top