在ASP.NET MVC中的所有内置ActionResults [英] All inbuilt ActionResults in ASP.NET MVC
问题描述
我在ASP.NET MVC控制器寻找内在的列表(和第三方将是一个奖金)ActionResults你已经提供给你。
I'm looking for a list of the inbuilt (and 3rd party would be a bonus) ActionResults you have available to you in a controller in ASP.NET MVC.
到目前为止,我发现了以下内容:
So far I've discovered the following:
- ContentResult类型 - this.Content()
- 的ActionResult - this.View()
- JsonResult - this.Json()
- JavascriptResult - this.Javascript()
- PartialViewResult - this.PartialView()
我错过了任何有用的是在那里?
Have I missed any useful ones that are out there?
推荐答案
-
ContentResult类型
直接写入一个字符串值到HTTP响应。
From this source:
ContentResult
Writes a string value directly into the HTTP response.EmptyResult
不写入到HTTP响应。EmptyResult
Does not write to the HTTP response.FileContentResult
需要一个文件的内容(重新psented作为字节数组$ P $)和内容写入HTTP响应。FileContentResult
Takes the contents of a file (represented as an array of bytes) and write the contents into the HTTP response.FilePathResult
需要在给定的位置的文件的内容,并将内容写入到HTTP响应FilePathResult
Takes the contents of a file at the given location and writes the contents into the HTTP response.FileStreamResult
采用由控制器产生一个文件流和写入流进HTTP响应。FileStreamResult
Takes a file stream produced by the controller and writes the stream into the HTTP response.HttpUnauthorizedResult
当授权检查失败被授权使用的特殊效果滤镜。HttpUnauthorizedResult
A special result used by authorization filters when authorization checks fail.JavaScriptResult
响应与客户端执行脚本的客户端。JavaScriptResult
Responds to the client with a script for the client to execute.JsonResult
回应与JavaScript对象符号(JSON)数据的客户。JsonResult
Responds to the client with data in JavaScript Object Notation (JSON).RedirectResult
重定向客户到一个新的URL。RedirectResult
Redirects the client to a new URL.RedirectToRouteResult
呈现指定的视图与HTML片段(通常在AJAX情况下使用)响应。RedirectToRouteResult
Renders the specified view to respond with an HTML fragment (typically used in AJAX scenarios).PartialViewResult
呈现指定的视图与HTML片段(通常在AJAX情况下使用)响应。PartialViewResult
Renders the specified view to respond with an HTML fragment (typically used in AJAX scenarios).的ViewResult
呈现指定的视图,并响应与HTML客户端。ViewResult
Renders the specified view and responds to the client with HTML.这篇关于在ASP.NET MVC中的所有内置ActionResults的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!