HttpRequest.InputStream 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取传入的 HTTP 实体主体的内容。
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
属性值
表示传入 HTTP 内容主体的内容的 Stream 对象。
示例
下面的代码示例将字符串 InputStream 中的内容复制到字符串中。
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