ASP » Request » BinaryRead

Before the method is executed, Count contains the number of bytes to be read. After the method has returned, Count contains the actual number of bytes read. The number read should be less than or equal to the total byte count value returned by Request.TotalByte.

The BinaryRead method retrieves the data that was sent to the server from the browser as part of a POST request, and returns the number of bytes read.

The BinaryRead method retrieves the unparsed data that was sent to the server from the user as part of an HTTP POST (i.e. an HTML FORM request). The data read is stored in a SafeArray which is a variant, structure-like array that, in addition to storing the data, also stores the number of dimensions of the array and the upper bounds of those dimensions.

You can write binary data into the response stream (info sent to a client) by using the Response.BinaryWrite(BinaryData) method. The BinaryData argument is simply the output (the SafeArray) from Request.BinaryRead. For example, you could retrieve an image from a database with Request.BinaryRead and send it to a client using Response.BinaryWrite.

Using Request.Form after calling BinaryRead, and vice-versa, will cause an error.

There is one mandatory argument.


Dim ByteCount, BinRead
ByteCount = Request.TotalBytes
BinRead = Request.BinaryRead(ByteCount)