Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 查看传递到Json中的模型对象_C#_Json_Asp.net Mvc 4 - Fatal编程技术网

C# 查看传递到Json中的模型对象

C# 查看传递到Json中的模型对象,c#,json,asp.net-mvc-4,C#,Json,Asp.net Mvc 4,如何在asp.net mvc应用程序中的任何位置使用模型对象,在该位置发出返回Json调用?在asp.NETMVC4管道中是否有一个地方,在将模型对象放入“returnJSON”调用后,我可以在那里访问它?例如,下面是我的控制器操作方法。。如何在属性方面查看myTestModel内部。我希望能够对任何模型对象的所有返回Json调用执行此操作 public JsonResult MyTestJsonB() { var myTestModel = new TestModel

如何在asp.net mvc应用程序中的任何位置使用模型对象,在该位置发出返回Json调用?在asp.NETMVC4管道中是否有一个地方,在将模型对象放入“returnJSON”调用后,我可以在那里访问它?例如,下面是我的控制器操作方法。。如何在属性方面查看myTestModel内部。我希望能够对任何模型对象的所有返回Json调用执行此操作

public JsonResult MyTestJsonB()
{
    var myTestModel = new TestModel
        {
            LastModified = DateTime.UtcNow,
            LastModifiedNullable = DateTime.UtcNow,
            TheStrinDateTime = "hello"
        };

    return Json(myTestModel, "text/plain", JsonRequestBehavior.AllowGet);
}

你的意思是什么?我不清楚在我的asp.net mvc应用程序中,在我的控制器中的action方法中,我想捕获在返回Json代码、模型对象中传递的内容,并对其进行处理,这样我就有了一个集中的代码。这样,我的程序员就不必记得每次需要在controller中的操作结束时返回Json时都要编写一个特殊的函数。有意义??是的,有意义,但根据我的经验,这是不可能的,就像你想要一个动作过滤器和覆盖ResultExecuting一样。