.net - Parse Ajax Posted JSON data in DelegatingHandler -
without going details of why want this, here want do.
json data posted using jquery so:
jq.ajax({ url: 'api/values', type: 'post', datatype: 'json', data: { a: 'hello', b: 'world' } });
in webapi delegatinghandler, i'd parse content json:
protected async override task<httpresponsemessage> sendasync(httprequestmessage request, cancellationtoken cancellationtoken) { var data = request.content.readasstringasync().result; //data url encoded, want json... //??? //...i'm going json string here var response = await base.sendasync(request, cancellationtoken); return response; }
json.net time gets webapi method that's going handle it, it's doable, i'm not sure how.
note don't need typed or - plain json string do.
Comments
Post a Comment