Hi Jules: If i use old version of ASP.net, Can i Deserialize Json data? thanks Jules!!!
On Aug 11, 3:01 pm, Jules <jwira...@gmail.com> wrote: > Opps, > You are right, change the contentType to > > contentType: "application/json; charset=utf-8" > > here is a snippet to handle generic json in C# .NET 3.5 > > JavaScriptSerializer ser = new JavaScriptSerializer(); > StreamReader reader = new StreamReader(Request.InputStream); > object input = ser.DeserializeObject(reader.ReadToEnd()); > string args = ((Dictionary<string, object>)input)["Args"] as string; > > or if you have the object defined use > > System.Runtime.Serialization.Json.DataContractJsonSerializer > > More info in > > http://www.west-wind.com/WebLog/posts/218001.aspx > > On Aug 11, 12:23 pm, yi <falconh...@gmail.com> wrote: > > > hi Jules: > > I use Request("Arg") , but it doesn't work. it always give me empty > > string > > contentType: "text" is it right? > > do i need make it contentType: "Json", ????? > > If i need use JSON, do you know how to read json data at sever side in > > asp.net? > > thanks so much!!! > > > On Aug 11, 12:50 pm, Jules <jwira...@gmail.com> wrote: > > > > Use Request("Arg") instead, this syntax gets the Arg from data post or > > > querystring. > > > Do not enclose args2, the server will get "args2" instead of the value > > > of args2. > > > > data:{Arg:args2} > > > > On Aug 11, 10:12 am, yi <falconh...@gmail.com> wrote: > > > > > Hi Jules: > > > > thank you for your help!! > > > > if I use this: > > > > > type: "POST", > > > > url: "mywebpage.aspx, > > > > data:{Arg:"args2"} > > > > > Do you know how can i get value of arg from sever side(code behind)? I > > > > use asp.net, but i dont know how to fatch data when data put inside > > > > {}, " data:{Arg:"args2"} " > > > > Can i still use "Request.QueryString()" function? > > > > > thanks > > > > > On Aug 11, 10:56 am, Jules <jwira...@gmail.com> wrote: > > > > > > There is a limit on url length depending on the browser. > > > > > >http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... > > > > > > use type:"POST" and data: instead and do not enclose the object > > > > > declaration > > > > > > data:{Arg:args2} instead of data:"{Arg:args2}" > > > > > > On Aug 11, 8:41 am, yi <falconh...@gmail.com> wrote: > > > > > > > $.ajax({ > > > > > > > type: "POST", > > > > > > > url: "mywebpage.aspx? > > > > > > Arg="+args2, > > > > > > > contentType: "text", > > > > > > > data:"{}", > > > > > > > dataType: "text", > > > > > > > success: CompleteInsert, > > > > > > > error: onFail > > > > > > > }); > > > > > > > I dont know why the onFail function is going to be executed when > > > > > > args2 > > > > > > is too big. > > > > > > args2 is a string type > > > > > > can anyone explain this > > > > > > thanks