angular http post json对象没有被mvc4正确反序列化

时间:2017-01-30 02:14:37

标签: angularjs json asp.net-mvc asp.net-mvc-4

在我的Angularjs服务中,我有这段代码:

By.xpath("//a[text()='New']");

这是我的MVC代码,我尝试反序列化它。

$http.post(baseUrl + "Location/SaveBulk/", { "BulkPrice": run }, { cache: false });

我的BULKPRICE课程如下

 <HttpPost>
    Public Function SaveBulk(ByVal BulkPrice As Object) As ActionResult

        Dim req As Stream = Request.InputStream
        req.Seek(0, System.IO.SeekOrigin.Begin)
        Dim json As String = New StreamReader(req).ReadToEnd()
        req.Close()
        Dim objModel As BulkPrice = Nothing

        Try

            objModel = JsonConvert.DeserializeObject(Of BulkPrice)(json)

            'do stuff

        Catch

            ' Try and handle malformed POST body
            Return New HttpStatusCodeResult(HttpStatusCode.BadRequest)
        End Try

        'do stuff
        Return View("Index")

    End Function

Fiddler请求如下 enter image description here

InputStream正确读取数据,但DeserializeObject()没有正确反序列化。

任何帮助都会得到满足。

0 个答案:

没有答案