Επεξεργασία

Κοινή χρήση μέσω


HttpRequest.InsertEntityBody Method

Definition

Provides a managed wrapper for the IIS method that inserts an HTTP request entity body into memory.

Overloads

InsertEntityBody()

Provides IIS with a copy of the HTTP request entity body.

InsertEntityBody(Byte[], Int32, Int32)

Provides IIS with a copy of the HTTP request entity body and with information about the request entity object.

Remarks

The InsertEntityBody method overloads provide managed access to the IIS 7 IHttpRequest::InsertEntityBody method. The IIS method inserts an HTTP request entity body (the data that is posted by a client) into memory. This is useful because IIS does not maintain a copy of the request entity after it has been read. The InsertEntityBody methods create a copy of the HTTP request entity data and make it available to IIS for additional custom handling.

Note

The InsertEntityBody method overloads work only on IIS 7.0 or later, because the IHttpRequest::InsertEntityBody method was added in IIS 7.0.

InsertEntityBody()

Provides IIS with a copy of the HTTP request entity body.

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

Exceptions

The method was invoked on a version of IIS earlier than IIS 7.0.

Remarks

IIS does not maintain a copy of the request after it has been read. Therefore, it is recommended that only the handler for an HTTP request should read the request entity.

The HttpRequest.InsertEntityBody method overload provides IIS with a copy of the request entity if it was previously read by ASP.NET. This method overload is useful for cases where ASP.NET has read the entity request and you want to reuse the existing request data.

Applies to

InsertEntityBody(Byte[], Int32, Int32)

Provides IIS with a copy of the HTTP request entity body and with information about the request entity object.

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)

Parameters

buffer
Byte[]

An array that contains the request entity data.

offset
Int32

The zero-based position in buffer at which to begin storing the request entity data.

count
Int32

The number of bytes to read into the buffer array.

Exceptions

The method was invoked on a version of IIS earlier than IIS 7.0.

buffer is null.

offset or count is a negative value.

The number of items in count is larger than the available space in buffer, given the offset value.

Remarks

IIS does not maintain a copy of the request after it has been read. Therefore, it is recommended that only the handler for an HTTP request should read the request entity.

The HttpRequest.InsertEntityBody method overload is useful when you want to perform custom processing, such as inserting a different entity body into memory.

Applies to