Actionresult vs JSONresult

后端 未结 5 1208
没有蜡笔的小新
没有蜡笔的小新 2020-12-14 07:07

I have 2 questions:

  1. What is the difference between JSONResult and ActionResult?

  2. When to use JSONResult in MVC?

5条回答
  •  感情败类
    2020-12-14 07:23

    According to the MSDN documentation for the ActionResult:

    The ActionResult class Encapsulates the result of an action method and is used to perform a framework-level operation on behalf of the action method.

    An action method responds to user input by performing work and returning an action result. An action result represents a command that the framework will perform on behalf of the action method. The ActionResult class is the base class for action results

    And for JsonResult:

    Represents a class that is used to send JSON-formatted content to the response.

提交回复
热议问题