All inbuilt ActionResults in ASP.NET MVC

核能气质少年 提交于 2019-12-01 08:54:40

From this source:

  • ContentResult
    Writes a string value directly into the HTTP response.

  • EmptyResult
    Does not write to the HTTP response.

  • FileContentResult
    Takes the contents of a file (represented as an array of bytes) and write the contents into the HTTP response.

  • FilePathResult
    Takes the contents of a file at the given location and writes the contents into the HTTP response.

  • FileStreamResult
    Takes a file stream produced by the controller and writes the stream into the HTTP response.

  • HttpUnauthorizedResult
    A special result used by authorization filters when authorization checks fail.

  • JavaScriptResult
    Responds to the client with a script for the client to execute.

  • JsonResult
    Responds to the client with data in JavaScript Object Notation (JSON).

  • RedirectResult
    Redirects the client to a new URL.

  • RedirectToRouteResult
    Renders the specified view to respond with an HTML fragment (typically used in AJAX scenarios).

  • PartialViewResult
    Renders the specified view to respond with an HTML fragment (typically used in AJAX scenarios).

  • ViewResult
    Renders the specified view and responds to the client with HTML.

3rd party: MVCcontrib XmlResult

The book, ASP.NET MVC 1.0, has the following results (p 235): EmptyResult, ContentResult, JsonResult, RedirectResult, RedirectToRouteResult, ViewResult, PartialViewResult, FilePathResult, FileContentResult, FileStreamResult, JavaScriptResult

You can find out more specifics about each one here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!