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 Stream InputStream { get; }
/** @property */
public Stream get_InputStream ()

public function get InputStream () : Stream

Property Value

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 : 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 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0