Link to home
Start Free TrialLog in
Avatar of afterthought
afterthought

asked on

Submitting XMLHTTP request - POST size limit

I have a VB app that submits XMLHTTP requests.  Previously, I would use the following code:

  Set oXMLReq = New MSXML2.XMLHTTP
  sURL = "https://www.oursite.com/asp/Validate.asp?Username=George&Password=12345"
  oXMLReq.Open "POST", sURL, True
  oXMLReq.send

The response would be loaded into a DOM document then opened into a recordset.  This approach works fine... until our requests (sURL) exceed 2000+ characters, at which point we receive the following error: "The system cannot locate the resource specified"

I found this link, http://www.up.org.nz/community/viewthread.php?tid=612 (not necessary to read), which provided a work-around for my problem.  Here's my new code:

  Set oXMLReq = New MSXML2.XMLHTTP
  sURL = "https://www.oursite.com/asp/Validate.asp"
  sExpression = "Username=George&Password=12345"
  oXMLReq.Open "POST", sURL, True
  oXMLReq.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
  oXMLReq.send sExpression

This code however returns responseText = "" as its response; I would have assumed that because it's essential the same operation as the first code sample above, that the results would be the same too.  Aren't these 2 code samples doing the same thing??  Therefore the results should be the same... no?

I think I'm missing something fundamental here.  Am I going about this the wrong way?  Any insight would be greatly appreciated!!
ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
By the way, there is no size limit to POST.  There is however a limit to GET and the query string.  The query string is the parameterized string that follows the URL of the script you are calling.  POST embeds the data in the HTTP request itself, so it is not limited in the same way.

On the server side ASP script, the request.querystring is used to read the query string of a GET operation.  request.form is used to read the data sent by POST...
Avatar of afterthought
afterthought

ASKER

Paul,
Thanks so much for your helpful insight!  You correctly guessed that Validate.asp was indeed using Requst.QueryString.  I've corrected it and everything is now working great!  The size limitation is gone now as well.  Thank you!!!