HttpRequest.InsertEntityBody 方法

定义

为 IIS 方法提供托管包装器,该方法将 HTTP 请求实体正文插入内存中。

重载

名称 说明
InsertEntityBody()

为 IIS 提供 HTTP 请求实体正文的副本。

InsertEntityBody(Byte[], Int32, Int32)

为 IIS 提供 HTTP 请求实体正文的副本以及有关请求实体对象的信息。

注解

该方法 InsertEntityBody 重载提供对 IIS 7 IHttpRequest::InsertEntityBody 方法的托管访问权限。 IIS 方法将 HTTP 请求实体正文(客户端发布的数据)插入内存中。 这很有用,因为 IIS 在读取请求实体后不会保留请求实体的副本。 这些 InsertEntityBody 方法创建 HTTP 请求实体数据的副本,并使其可供 IIS 用于其他自定义处理。

注释

方法 InsertEntityBody 重载仅适用于 IIS 7.0 或更高版本,因为在 IHttpRequest::InsertEntityBody IIS 7.0 中添加了该方法。

InsertEntityBody()

为 IIS 提供 HTTP 请求实体正文的副本。

public:
 void InsertEntityBody();
public void InsertEntityBody();
member this.InsertEntityBody : unit -> unit
Public Sub InsertEntityBody ()

例外

该方法是在 IIS 7.0 之前的 IIS 版本中调用的。

注解

IIS 在读取请求后不会保留该请求的副本。 因此,建议只有 HTTP 请求的处理程序应读取请求实体。

HttpRequest.InsertEntityBody 方法重载为 IIS 提供请求实体的副本(如果以前由 ASP.NET 读取)。 此方法重载适用于 ASP.NET 已读取实体请求,并且想要重复使用现有请求数据的情况。

适用于

InsertEntityBody(Byte[], Int32, Int32)

为 IIS 提供 HTTP 请求实体正文的副本以及有关请求实体对象的信息。

public:
 void InsertEntityBody(cli::array <System::Byte> ^ buffer, int offset, int count);
public void InsertEntityBody(byte[] buffer, int offset, int count);
member this.InsertEntityBody : byte[] * int * int -> unit
Public Sub InsertEntityBody (buffer As Byte(), offset As Integer, count As Integer)

参数

buffer
Byte[]

包含请求实体数据的数组。

offset
Int32

从零开始存储请求实体数据的位置 buffer

count
Int32

要读入数组的 buffer 字节数。

例外

该方法是在 IIS 7.0 之前的 IIS 版本中调用的。

buffernull

offsetcount 为负值。

鉴于count值,其中buffer项的数目大于可用空间offset

注解

IIS 在读取请求后不会保留该请求的副本。 因此,建议只有 HTTP 请求的处理程序应读取请求实体。

如果要执行自定义处理,例如将其他实体正文插入内存中,此方法 HttpRequest.InsertEntityBody 重载非常有用。

适用于