HttpRequest Class

Represents the incoming side of an individual HTTP request.

Namespace
Microsoft.AspNetCore.Http
Assemblies
  • Microsoft.AspNetCore.Http.Abstractions

Syntax

public abstract class HttpRequest
class Microsoft.AspNetCore.Http.HttpRequest

Properties

Microsoft.AspNetCore.Http.HttpRequest.Body

Gets or set the RequestBody Stream.

Return type:System.IO.Stream
Returns:The RequestBody Stream.
public abstract Stream Body { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.ContentLength

Gets or sets the Content-Length header

Return type:System.Nullable<System.Int64>
public abstract long ? ContentLength { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.ContentType

Gets or sets the Content-Type header.

Return type:System.String
Returns:The Content-Type header.
public abstract string ContentType { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.Cookies

Gets the collection of Cookies for this request.

Return type:Microsoft.AspNetCore.Http.IRequestCookieCollection
Returns:The collection of Cookies for this request.
public abstract IRequestCookieCollection Cookies { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.Form

Gets or sets the request body as a form.

Return type:Microsoft.AspNetCore.Http.IFormCollection
public abstract IFormCollection Form { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.HasFormContentType

Checks the content-type header for form types.

Return type:System.Boolean
public abstract bool HasFormContentType { get; }
Microsoft.AspNetCore.Http.HttpRequest.Headers

Gets the request headers.

Return type:Microsoft.AspNetCore.Http.IHeaderDictionary
Returns:The request headers.
public abstract IHeaderDictionary Headers { get; }
Microsoft.AspNetCore.Http.HttpRequest.Host

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

Return type:Microsoft.AspNetCore.Http.HostString
public abstract HostString Host { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.HttpContext

Gets the Microsoft.AspNetCore.Http.HttpRequest.HttpContext this request;

Return type:Microsoft.AspNetCore.Http.HttpContext
public abstract HttpContext HttpContext { get; }
Microsoft.AspNetCore.Http.HttpRequest.IsHttps

Returns true if the RequestScheme is https.

Return type:System.Boolean
Returns:true if this request is using https; otherwise, false.
public abstract bool IsHttps { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.Method

Gets or set the HTTP method.

Return type:System.String
Returns:The HTTP method.
public abstract string Method { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.Path

Gets or set the request path from RequestPath.

Return type:Microsoft.AspNetCore.Http.PathString
Returns:The request path from RequestPath.
public abstract PathString Path { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.PathBase

Gets or set the RequestPathBase.

Return type:Microsoft.AspNetCore.Http.PathString
Returns:The RequestPathBase.
public abstract PathString PathBase { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.Protocol

Gets or set the RequestProtocol.

Return type:System.String
Returns:The RequestProtocol.
public abstract string Protocol { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.Query

Gets the query value collection parsed from Request.QueryString.

Return type:Microsoft.AspNetCore.Http.IQueryCollection
Returns:The query value collection parsed from Request.QueryString.
public abstract IQueryCollection Query { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.QueryString

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

Return type:Microsoft.AspNetCore.Http.QueryString
Returns:The raw query string.
public abstract QueryString QueryString { get; set; }
Microsoft.AspNetCore.Http.HttpRequest.Scheme

Gets or set the HTTP request scheme.

Return type:System.String
Returns:The HTTP request scheme.
public abstract string Scheme { get; set; }

Methods

ReadFormAsync(System.Threading.CancellationToken)

Reads the request body if it is a form.

Return type:System.Threading.Tasks.Task<Microsoft.AspNetCore.Http.IFormCollection>
public abstract Task<IFormCollection> ReadFormAsync(CancellationToken cancellationToken = null)