We help IT Professionals succeed at work.

Anatomy of HTTP post

FouadDaniels asked
Last Modified: 2012-06-27
Hi Experts,

Someone is sending me a HTTP post ( NOT useing form elements, NOT querysring NOT even using a web browser to make the HTTP post ) to my asp page

How in asp to I read that post?

Fouad Daniels
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)


type mismatch:

I dont have that function and the code craches.

Fouad Daniels

Sorry, I forgot to paste that function as well.  :-(

Function MultiByteToBinary(MultiByte)
      Dim RS, LMultiByte, Binary
      Const adLongVarBinary = 205
      Set RS = CreateObject("ADODB.Recordset")
      LMultiByte = LenB(MultiByte)
      If LMultiByte>0 Then
            RS.Fields.Append "mBinary", adLongVarBinary, LMultiByte
            RS("mBinary").AppendChunk MultiByte & ChrB(0)
            Binary = RS("mBinary").GetChunk(LMultiByte)
      End If
      MultiByteToBinary = Binary
End Function


If you post this at my previous question aswell I will give you the other 500 points aswell

> If you post this at my previous question aswell I will give you the other 500 points aswell

Already done. Have a look...

And thanks for the points.


Where can I find a good tutorial on what the hell is going on in your script. I can follow almsote all of it but the parts I dont follow are wickidly unknown to me.


Fouad Daniels

I plunderd most of the code from somewhere (can't remember where - it was a long time ago).

There are many such functions out there. Some of them use the ADO Stream object and some, like the ones I posted, use an ADO Recordset object.

The function MultiByteToBinary() unsurprisingly converts a multi-byte array (sometimes called a safe-array, or even just an array of bytes) into a single binary value. It works by creating an empty recordset object then adding a BLOB field to it, then using the AppendChunk method to add the binary data to the new field. In effect this is just writing the value of binary array into a BLOB field but the AppendChunk method lets you specify either character or binary data. GetChunk does the opposite in that it pulls out the BLOB data from the field. The truth is I don't really know how it converts between a byte array and single binary value. This is just some intrinsic ADO functionality and I have to be happy with the explanation that "it just works". It seems that AppendChunk will convert the byte array into binary and append it to any existing data that's in the field (and since we've just created the field we know that it's empty).

The function RSBinaryToString() is kind-of similar except that the newly created field is a text field instead of a BLOB field. After appending the chunk of binary data to the field the function simply returns the .value property of the field. Since it's a string data type a string is returned.

The great mystery to me is why you can't just append the byte array to the text field and do away with the MultiByteToBinary() function. But again, I think that's getting into the serious nitty-gritty of ADO so once again I calm down by reminding myself "it works".

Hope that gives you some idea what's going on. Not rocket science but quite nifty.

AppendChunk method of ADO Field object:


GetChunk method of ADO Field object:

Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.