我有两个问题:
What is the difference between JSONResult and ActionResult?
When to use JSONResult in MVC?
最佳答案
ActionResult
是一个 Action 可以返回的抽象类。Controller
中的辅助方法(例如, Json()
、 Content()
、 View()
、...)返回不同的继承 ActionResult
的具体类,包括 JsonResult
.
您应该将您的操作方法声明为返回 ActionResult
,这样他们就可以自由地返回任何具体的结果类。
关于asp.net-mvc - Actionresult 与 JSONresult,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15250941/