我正在使用API从页面发送数据。如果我发送的是ASCII格式的数据,则一切正常,但如果从UTF-8发送数据,则参数FromBody返回Nothing。
我的控制器:
Public Function AddContacts(PartnerId As Long,<FromBody()> ByVal value As Json.Contacts) As HttpResponseMessage
Dim liErr As New List(Of API.Universal.Json.MyError)
If PostData.SaveContacts(PartnerId,value,liErr,_Conn.Connection) Then
Return Request.CreateResponse(HttpStatusCode.accepted,New API.Universal.Json.MyErrors(liErr.ToArray))
Else
Return Request.CreateResponse(HttpStatusCode.OK,New API.Universal.Json.MyErrors(liErr.ToArray))
End If
End Function
我的帖子数据:
Content-Type: application/json; charset=utf-8
{
"txtFirstName": "","txtLastName": "","txtAddress": "","txtCity": "","txtPostalCode": "","cmbCountry": "","txtPhone": "","txtEmail": "mail@ss.sd","cmbLanguage": "CS","txtNote": "testovací poznámka"
}