Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
InputStream Property

HttpRequest.InputStream Property

Gets the contents of the incoming HTTP entity body.

[Visual Basic]
Public ReadOnly Property InputStream As Stream
public Stream InputStream {get;}
public: __property Stream* get_InputStream();
public function get InputStream() : Stream;

Property Value

A Stream object representing the contents of the incoming HTTP content body.


[Visual Basic, JScript] This example copies the contents of an InputStream into a string.

[Visual Basic] 
Dim str As Stream, strmContents As String
Dim counter, strLen, strRead As Integer
' Create a Stream object.
str = Request.InputStream
' Find number of bytes in stream.
strLen = CInt(str.Length)
' Create a byte array.
Dim strArr(strLen) As Byte 
' Read stream into byte array.
strRead = str.Read(strArr,0,strLen) 
' Convert byte array to a text string.
For counter = 0 To strLen-1
   strmContents = strmContents & strArr(counter).ToString()
Next counter

var str : Stream
var sb : StringBuilder = new StringBuilder()
var strmContents : String
var strLen, strRead : int

str = Request.InputStream             // Create a Stream object.
strLen = str.Length                   // Find number of Bytes in stream.
var strArr: Byte[] = new Byte[strLen] // Create a Byte array.
strRead = str.Read(strArr,0,strLen)   // Read stream into Byte array.

// Convert Byte array to a text string.
for(var counter=0; counter < strLen; counter++){
strmContents = sb.ToString();

[C#, C++] No example is available for C# or C++. To view a Visual Basic or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpRequest Class | HttpRequest Members | System.Web Namespace

© 2015 Microsoft