我将带有日期值“02/11/2015”(DD/MM/YYYY)的 JSON 对象提交给 API 控制器。由于某种原因,它在装订时被转换为美国格式(2 月 11 日)。我在同一个解决方案中有标准的 MVC 控制器,它正确地绑定了以相同格式提交的日期值(英国)。什么会导致这种差异:
以下是标准 MVC 提交标头:
Accept:*/*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8,pl;q=0.6
Cache-Control:no-cache
Connection:keep-alive
X-Requested-With:XMLHttpRequest
并形成数据
StartDate : 01/11/2015
这是 API 调用标头
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,pl;q=0.6
Cache-Control:no-cache
Connection:keep-alive
Content-Type:application/json; charset=UTF-8
X-Requested-With:XMLHttpRequest
和我传递的 JSON 对象
{ DateStart: "01/11/2015" }