什么是所有的ASP.Net MVC行动的结果? [英] What are all the ASP.Net MVC Action Results?
问题描述
有所有的ASP.Net MVC行动的结果和他们的用途清单?
Is there a list of all the ASP.Net MVC action results and their uses?
我一直在忙于用的ActionResult几乎一切,但我知道这不是正确的,我应该使用更具体的行动结果。
I've been busily using ActionResult for almost everything but I know that's not correct and that I should be using more specific action results.
我GOOGLE了这一点,但无法找到一个列表。我们刚刚买了Wrox的书,但它是一个多星期远离交付,我想之前就再在此读了。
I've Googled this but cannot find a list. We've just bought the Wrox book but it's more than a week away from delivery and I'd like to read up on this well before then.
你能不能也推出自己的,并且是记录在案的地方?
Can you also roll your own and is that documented somewhere?
推荐答案
如果您打开 System.Web.Mvc
使用的Reflector~~V ,你会看到有从抽象类继承的ActionResult几个派生类型。它们是:
If you open System.Web.Mvc
using Reflector, you will see that there are several derived types that inherit from the abstract class ActionResult. They are:
System.Web.Mvc.ContentResult
System.Web.Mvc.EmptyResult
System.Web.Mvc.FileResult
System.Web.Mvc.FileContentResult
System.Web.Mvc.FilePathResult
System.Web.Mvc.FileStreamResult
System.Web.Mvc.HttpUnauthorizedResult
System.Web.Mvc.JavaScriptResult
System.Web.Mvc.JsonResult
System.Web.Mvc.RedirectResult
System.Web.Mvc.RedirectToRouteResult
System.Web.Mvc.ViewResultBase
System.Web.Mvc.PartialViewResult
System.Web.Mvc.ViewResult
是的,你可以通过从抽象类继承的ActionResult滚你自己的。你可以研究一个或多个ActionResults在列表上面反射得到一个感受如何做到这一点来完成。
Yes, you can roll your own by inheriting from the abstract class ActionResult. You can study one or more of the ActionResults in the list above with Reflector to get a feel for how this would be done.
源$ C $ C也可以在这里找到:
The source code is also available here:
<一个href=\"http://aspnet.$c$cplex.com/Release/ProjectReleases.aspx?ReleaseId=24471\">http://aspnet.$c$cplex.com/Release/ProjectReleases.aspx?ReleaseId=24471
这篇关于什么是所有的ASP.Net MVC行动的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!