HttpContext Class

Definition

Encapsulates all HTTP-specific information about an individual HTTP request.

public ref class HttpContext abstract
public abstract class HttpContext
type HttpContext = class
Public MustInherit Class HttpContext
Inheritance
HttpContext
Derived

Constructors

HttpContext()

Properties

Authentication

This is obsolete and will be removed in a future version. The recommended alternative is to use Microsoft.AspNetCore.Authentication.AuthenticationHttpContextExtensions. See https://go.microsoft.com/fwlink/?linkid=845470.

Connection

Gets information about the underlying connection for this request.

Features

Gets the collection of HTTP features provided by the server and middleware available on this request.

Items

Gets or sets a key/value collection that can be used to share data within the scope of this request.

Request

Gets the HttpRequest object for this request.

RequestAborted

Notifies when the connection underlying this request is aborted and thus request operations should be cancelled.

RequestServices

Gets or sets the IServiceProvider that provides access to the request's service container.

Response

Gets the HttpResponse object for this request.

Session

Gets or sets the object used to manage user session data for this request.

TraceIdentifier

Gets or sets a unique identifier to represent this request in trace logs.

User

Gets or sets the user for this request.

WebSockets

Gets an object that manages the establishment of WebSocket connections for this request.

Methods

Abort()

Aborts the connection underlying this request.

Extension Methods

AuthenticateAsync(HttpContext)

Extension method for authenticate using the DefaultAuthenticateScheme scheme.

AuthenticateAsync(HttpContext, String)

Extension method for authenticate.

ChallengeAsync(HttpContext)

Extension method for authenticate using the DefaultChallengeScheme scheme.

ChallengeAsync(HttpContext, AuthenticationProperties)

Extension method for authenticate using the DefaultChallengeScheme scheme.

ChallengeAsync(HttpContext, String)

Extension method for Challenge.

ChallengeAsync(HttpContext, String, AuthenticationProperties)

Extension method for Challenge.

ForbidAsync(HttpContext)

Extension method for Forbid using the DefaultForbidScheme scheme..

ForbidAsync(HttpContext, AuthenticationProperties)

Extension method for Forbid.

ForbidAsync(HttpContext, String)

Extension method for Forbid.

ForbidAsync(HttpContext, String, AuthenticationProperties)

Extension method for Forbid.

GetTokenAsync(HttpContext, String)

Extension method for getting the value of an authentication token.

GetTokenAsync(HttpContext, String, String)

Extension method for getting the value of an authentication token.

SignInAsync(HttpContext, ClaimsPrincipal)

Extension method for SignIn using the DefaultSignInScheme.

SignInAsync(HttpContext, ClaimsPrincipal, AuthenticationProperties)

Extension method for SignIn using the DefaultSignInScheme.

SignInAsync(HttpContext, String, ClaimsPrincipal)

Extension method for SignIn.

SignInAsync(HttpContext, String, ClaimsPrincipal, AuthenticationProperties)

Extension method for SignIn.

SignOutAsync(HttpContext)

Extension method for SignOut using the DefaultSignOutScheme.

SignOutAsync(HttpContext, AuthenticationProperties)

Extension method for SignOut using the DefaultSignOutScheme.

SignOutAsync(HttpContext, String)

Extension method for SignOut.

SignOutAsync(HttpContext, String, AuthenticationProperties)

Extension method for SignOut.

GetEndpoint(HttpContext)

Extension method for getting the Endpoint for the current request.

SetEndpoint(HttpContext, Endpoint)

Extension method for setting the Endpoint for the current request.

GetServerVariable(HttpContext, String)

Gets the value of a server variable for the current request.

GetHttpRequestMessage(HttpContext)
GetRouteData(HttpContext)

Gets the RouteData associated with the provided httpContext.

GetRouteValue(HttpContext, String)

Gets a route value from Values associated with the provided httpContext.

GetIISServerVariable(HttpContext, String)

Gets the value of a server variable for the current request.

Applies to