HttpRequest.InputStream Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the contents of the incoming HTTP entity body.
public:
property System::IO::Stream ^ InputStream { System::IO::Stream ^ get(); };
public System.IO.Stream InputStream { get; }
member this.InputStream : System.IO.Stream
Public ReadOnly Property InputStream As Stream
Property Value
A Stream object representing the contents of the incoming HTTP content body.
Examples
The following code example copies the contents of an InputStream into a string.
System.IO.Stream str; String strmContents;
Int32 counter, strLen, strRead;
// Create a Stream object.
str = Request.InputStream;
// Find number of bytes in stream.
strLen = Convert.ToInt32(str.Length);
// Create a byte array.
byte[] strArr = new byte[strLen];
// Read stream into byte array.
strRead = str.Read(strArr, 0, strLen);
// Convert byte array to a text string.
strmContents = "";
for (counter = 0; counter < strLen; counter++)
{
strmContents = strmContents + strArr[counter].ToString();
}
Dim str As System.IO.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
Applies to
Sodelujte z nami v storitvi GitHub
Vir za to vsebino najdete v storitvi GitHub, kjer lahko tudi ustvarite in pregledate težave in zahtevke za uveljavitev sprememb. Če želite več informacij, glejte naš vodnik za sodelavce.