This documentation is archived and is not being maintained.

HttpRequest.InputStream Property

Gets the contents of the incoming HTTP entity body.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

public function get InputStream () : Stream

Property Value

Type: System.IO.Stream
A Stream object representing the contents of the incoming HTTP content body.

The following code example copies the contents of an InputStream into a string.

var str : System.IO.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();

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0