vendredi 15 avril 2016

DateTime parses differently when passed via HTTP-POST in body and via HTTP-GET as query params

On our MVC 3 Web Application we define the Thread.CurrentThread.CurrentCulture with the current user's preferences. However, in one View we submit the data via Ajax always in the format mm/dd/yyyy this works fine as long as the user's culture is en_US. (obviously)

The surprising thing, it works for all users, when we pass it as HTTP-POST, but stops working when we pass it as HTTP-GET. (In both cases, the exact same value is leaving the browser).

Any ideas why HTTP-POST calls would be handled differently than HTTP-GET?

Also, there are other parameters to that action. In case of an HTTP-POST, they are all set in the body like:

{
  "date": "04/15/2016",
  "someText": "Hello World",
  "someNumber": 42
}

and for HTTP-POST they are query parameters instead:

http://ift.tt/23AEyF8

Aucun commentaire:

Enregistrer un commentaire