c# - Web API can't deserialize a Javascript Date.toISOString()? -


i'm looking way pass javascript dates .net web api controllers without installing library on client...

i'm expecting javascript dates deserialize .net datetime.

var date = new date();  post({currentdate: date.toisostring()});  

arrives @ server datetime.min (indicating failed deserialize).

here's example of being sent on wire, apicontroller not able create datetime correct date...

request:

{"date":"2014-04-16t17:03:03.383z"} 

c#:

    [serializable]     public class myobj      {          public datetime date { get; set; }     }      public class mycontroller : apicontroller     {         public httpresponsemessage post(myobj dd)         {             // dd's date property equals datetime.min rather correct date...             return null;         }      } } 

remove [serializable] attribute.


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -