Until yet I was using httpHandlers for performing all server side logic and these htt开发者_运维知识库pHandlers were being called by jQuery $.Ajax.
In this case to pass any parameter I used to pass pure JSON object (obviously key value pairs) which was automatically translated to the Request.Form keys on serve side.
Now as I am trying to call WCF endpoint from jQuery, I know that to pass any parameter in JSON format I have to pass it as string may be using JSON.stringify.
But what I want to know is, what is the need for passing a string instead of JSON object. Why WCF did not allowed passing JSON object directly? If it is because, the JSON object can be tempered then that can happen to a string too.
Any ideas???
Thanks, Pranav Kaushik
PranavKaushik.Wordpress.com
Pranav, the reason is that WCF's JSON parsing is all .NET-powered on the server side, and as such, expects .NET-style strings in input for efficient parsing. Non-stringified JSON input would essentially wreck the default parsing mechanisms of .NET and force the WCF encoder/formatter stack to re-work and then re-interpret the JSON it gets.
精彩评论