Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #25624

Re: Post json to asp jscript

From Martin Honnen <mahotrash@yahoo.de>
Newsgroups comp.lang.javascript
Subject Re: Post json to asp jscript
Date 2014-08-04 10:32 +0200
Organization Liberty Development
Message-ID <lrngeq$15q2$1@adenine.netfront.net> (permalink)
References <QLCdndkekoKOkELOnZ2dnUVZ_oCdnZ2d@westnet.com.au>

Show all headers | View raw


Andrew Poulos wrote:
> I'm trying to us an elearning tracking piece of js called tincan that
> posts JSON to an endpoint. The content type is set to application/json
> and the request body (as IE's F12 developer console shows) is json. The
> response headers give
>
> response : HTTP/1.1 200 OK
> content-length : 0
> content-type : application/json; charset=utf-8
>
> Though Chrome's developer console gives a content length of 16568.
>
> When (on the server with classic ASP and JScript) I try
>
> var dat = Request.Form;
> or
> var dat = Request.Form + "";
> or
> var dat = eval("(" + Request.Form + ")");
>
> I just get 'undefined'.
>
> My question is, if the payload is not empty why does request give
> undefined?

As far as I remember, with classic ASP the Request.Form collection is 
provided for reading out the values posted by a HTML form. If you 
directly post JSON then I think you need to read out the request body 
with http://msdn.microsoft.com/en-us/library/ms525710%28v=vs.90%29.aspx, 
only the object you get from that is a SafeArray that does not fit in 
well with the JScript data types. So you need something along the lines of

  var responseArray = new 
VBArray(Request.BinaryRead(Request.TotalBytes)).toArray();

See 
http://msdn.microsoft.com/en-us/library/ie/y39d47w8%28v=vs.94%29.aspx 
for the methods.


--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Post json to asp jscript Andrew Poulos <ap_prog@hotmail.com> - 2014-08-04 14:30 +1000
  Re: Post json to asp jscript Martin Honnen <mahotrash@yahoo.de> - 2014-08-04 10:32 +0200
    Re: Post json to asp jscript Andrew Poulos <ap_prog@hotmail.com> - 2014-08-04 18:44 +1000
      Re: Post json to asp jscript Andrew Poulos <ap_prog@hotmail.com> - 2014-08-05 11:49 +1000
        Re: Post json to asp jscript Andrew Poulos <ap_prog@hotmail.com> - 2014-08-10 12:21 +1000
          Re: Post json to asp jscript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-08-10 09:52 +0200
            Re: Post json to asp jscript Andrew Poulos <ap_prog@hotmail.com> - 2014-08-11 08:44 +1000

csiph-web