HttpRequest Class

Definition

Represents the incoming side of an individual HTTP request.

public ref class HttpRequest abstract
public abstract class HttpRequest
type HttpRequest = class
Public MustInherit Class HttpRequest
Inheritance
HttpRequest

Constructors

HttpRequest()

Properties

Body

Gets or sets the request body Stream.

BodyReader

Gets the request body PipeReader.

ContentLength

Gets or sets the Content-Length header.

ContentType

Gets or sets the Content-Type header.

Cookies

Gets the collection of Cookies for this request.

Form

Gets or sets the request body as a form.

HasFormContentType

Checks the Content-Type header for form types.

Headers

Gets the request headers.

Host

Gets or sets the Host header. May include the port.

HttpContext

Gets the HttpContext for this request.

IsHttps

Returns true if the RequestScheme is https.

Method

Gets or sets the HTTP method.

Path

Gets or sets the request path from RequestPath.

PathBase

Gets or sets the RequestPathBase.

Protocol

Gets or sets the request protocol (e.g. HTTP/1.1).

Query

Gets the query value collection parsed from Request.QueryString.

QueryString

Gets or sets the raw query string used to create the query collection in Request.Query.

RouteValues

Gets the collection of route values for this request.

Scheme

Gets or sets the HTTP request scheme.

Methods

ReadFormAsync(CancellationToken)

Reads the request body if it is a form.

Extension Methods

GetMultipartBoundary(HttpRequest)
GetDisplayUrl(HttpRequest)

Returns the combined components of the request URL in a fully un-escaped form (except for the QueryString) suitable only for display. This format should not be used in HTTP headers or other HTTP operations.

GetEncodedPathAndQuery(HttpRequest)

Returns the relative URI.

GetEncodedUrl(HttpRequest)

Returns the combined components of the request URL in a fully escaped form suitable for use in HTTP headers and other HTTP operations.

GetTypedHeaders(HttpRequest)
EnableBuffering(HttpRequest)

Ensure the requestBody can be read multiple times. Normally buffers request bodies in memory; writes requests larger than 30K bytes to disk.

EnableBuffering(HttpRequest, Int32)

Ensure the requestBody can be read multiple times. Normally buffers request bodies in memory; writes requests larger than bufferThreshold bytes to disk.

EnableBuffering(HttpRequest, Int32, Int64)

Ensure the requestBody can be read multiple times. Normally buffers request bodies in memory; writes requests larger than bufferThreshold bytes to disk.

EnableBuffering(HttpRequest, Int64)

Ensure the requestBody can be read multiple times. Normally buffers request bodies in memory; writes requests larger than 30K bytes to disk.

ReadFormAsync(HttpRequest, FormOptions, CancellationToken)

Read the request body as a form with the given options. These options will only be used if the form has not already been read.

CheckTrailersAvailable(HttpRequest)

Checks if the request supports trailers and they are available to be read now. This does not mean that there are any trailers to read.

GetDeclaredTrailers(HttpRequest)

Gets the request "Trailer" header that lists which trailers to expect after the body.

GetTrailer(HttpRequest, String)

Gets the requested trailing header from the response. Check SupportsTrailers(HttpRequest) or a NotSupportedException may be thrown. Check CheckTrailersAvailable(HttpRequest) or an InvalidOperationException may be thrown.

SupportsTrailers(HttpRequest)

Indicates if the request supports receiving trailer headers.

Applies to