Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​AspNetCore.​Http.​HttpRequest
Assembly: Microsoft.AspNetCore.Http.Abstractions
Inheritance: object → HttpRequest
Represents the incoming side of an individual HTTP request.
Properties
public
HttpContext
HttpContext
Gets the <see cref="P:Microsoft.AspNetCore.Http.HttpRequest.HttpContext" /> for this request.
public
string
Method
Gets or sets the HTTP method.
public
string
Scheme
Gets or sets the HTTP request scheme.
public
bool
IsHttps
Returns true if the RequestScheme is https.
public
HostString
Host
Gets or sets the Host header. May include the port.
public
PathString
PathBase
Gets or sets the base path for the request. The path base should not end with a trailing slash.
public
PathString
Path
Gets or sets the portion of the request path that identifies the requested resource.
<para>
The value may be <see cref="F:Microsoft.AspNetCore.Http.PathString.Empty" /> if <see cref="P:Microsoft.AspNetCore.Http.HttpRequest.PathBase" /> contains the full path,
or for 'OPTIONS *' requests.
The path is fully decoded by the server except for '%2F', which would decode to '/' and
change the meaning of the path segments. '%2F' can only be replaced after splitting the path into segments.
</para>
public
QueryString
QueryString
Gets or sets the raw query string used to create the query collection in Request.Query.
public
IQueryCollection
Query
Gets the query value collection parsed from Request.QueryString.
public
string
Protocol
Gets or sets the request protocol (e.g. HTTP/1.1).
public
IHeaderDictionary
Headers
Gets the request headers.
public
IRequestCookieCollection
Cookies
Gets the collection of Cookies for this request.
public
long?
ContentLength
Gets or sets the Content-Length header.
public
string
ContentType
Gets or sets the Content-Type header.
Body
Gets or sets the request body <see cref="T:System.IO.Stream" /> .
Gets the request body <see cref="T:System.IO.Pipelines.PipeReader" /> .
public
bool
HasFormContentType
Checks the Content-Type header for form types.
public
IFormCollection
Form
Gets or sets the request body as a form.
Remarks <para>
Invoking this property could result in thread exhaustion since it's wrapping an asynchronous implementation.
To prevent this the method <see cref="M:Microsoft.AspNetCore.Http.HttpRequest.ReadFormAsync(System.Threading.CancellationToken)" /> can be used.
For more information, see <see href="https://aka.ms/aspnet/forms-async" />.
</para>
RouteValues
Gets the collection of route values for this request.
Methods
public
System.​Threading.​Tasks.​Task<​IFormCollection>
ReadFormAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Reads the request body if it is a form.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object