asp.net-mvcActionResult


Syntax

  • // ActionResult method returns an instance that derives from ActionResult. You are able to create action method that can return any instance that is wrapped in appropriate ActionResult type.

  • //Built-in ActionResult return types are:

  • View(); // ViewResult renders a view as a WebPage

  • PartialView(); // PartialViewResult renders a partial view, which can be used as a part of another view.

  • Redirect(); // RedirectResult redirects to another action method by using its URL.

  • RediectToAction(); RedirectToRoute(); // RedirectToRouteResult redirects to another action method.

  • Content(); // ContentResult returns a user-defined content-type.

  • Json(); // JsonResult returns a serialized JSON object.

  • JavaScript(); // JavaScriptResult returns a script that can be executed on client side.

  • File(); // FileResult returns a binary output to write to the reponse.

  • // EmptResult represents a return value that is used if action method must return a null result.