DefaultHttpContext Class

Definition

Represents an implementation of the HTTP Context class.

public ref class DefaultHttpContext : Microsoft::AspNetCore::Http::HttpContext
public ref class DefaultHttpContext sealed : Microsoft::AspNetCore::Http::HttpContext
public class DefaultHttpContext : Microsoft.AspNetCore.Http.HttpContext
public sealed class DefaultHttpContext : Microsoft.AspNetCore.Http.HttpContext
type DefaultHttpContext = class
    inherit HttpContext
Public Class DefaultHttpContext
Inherits HttpContext
Public NotInheritable Class DefaultHttpContext
Inherits HttpContext
Inheritance
DefaultHttpContext

Constructors

DefaultHttpContext()

Initializes a new instance of the DefaultHttpContext class.

DefaultHttpContext(IFeatureCollection)

Initializes a new instance of the DefaultHttpContext class with provided features.

Properties

Authentication
Obsolete.

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.

Authentication
Obsolete.

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.

(Inherited from HttpContext)
Connection
Features
FormOptions

Gets or set the FormOptions for this instance.

HttpContext
Items
Request
RequestAborted
RequestServices
Response
ServiceScopeFactory

Gets or sets the IServiceScopeFactory for this instance.

Session
TraceIdentifier
User
WebSockets

Methods

Abort()
Initialize(IFeatureCollection)

Reinitialize the current instant of the class with features passed in.

InitializeAuthenticationManager()
InitializeConnectionInfo()
InitializeHttpRequest()
InitializeHttpResponse()
InitializeWebSocketManager()
Uninitialize()

Uninitialize all the features in the DefaultHttpContext.

UninitializeAuthenticationManager(AuthenticationManager)
UninitializeConnectionInfo(ConnectionInfo)
UninitializeHttpRequest(HttpRequest)
UninitializeHttpResponse(HttpResponse)
UninitializeWebSocketManager(WebSocketManager)

Extension Methods

AuthenticateAsync(HttpContext)

Authenticate the current request using the default authentication scheme. The default authentication scheme can be configured using DefaultAuthenticateScheme.

AuthenticateAsync(HttpContext, String)

Authenticate the current request using the specified scheme.

ChallengeAsync(HttpContext)

Challenge the current request using the default challenge scheme. An authentication challenge can be issued when an unauthenticated user requests an endpoint that requires authentication. The default challenge scheme can be configured using DefaultChallengeScheme.

ChallengeAsync(HttpContext, AuthenticationProperties)

Challenge the current request using the default challenge scheme. An authentication challenge can be issued when an unauthenticated user requests an endpoint that requires authentication. The default challenge scheme can be configured using DefaultChallengeScheme.

ChallengeAsync(HttpContext, String)

Challenge the current request using the specified scheme. An authentication challenge can be issued when an unauthenticated user requests an endpoint that requires authentication.

ChallengeAsync(HttpContext, String, AuthenticationProperties)

Challenge the current request using the specified scheme. An authentication challenge can be issued when an unauthenticated user requests an endpoint that requires authentication.

ForbidAsync(HttpContext)

Forbid the current request using the default forbid scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access. The default forbid scheme can be configured using DefaultForbidScheme.

ForbidAsync(HttpContext, AuthenticationProperties)

Forbid the current request using the default forbid scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access. The default forbid scheme can be configured using DefaultForbidScheme.

ForbidAsync(HttpContext, String)

Forbid the current request using the specified scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access.

ForbidAsync(HttpContext, String, AuthenticationProperties)

Forbid the current request using the specified scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access.

GetTokenAsync(HttpContext, String)

Authenticates the request using the default authentication scheme and returns the value for the token. The default authentication scheme can be configured using DefaultAuthenticateScheme.

GetTokenAsync(HttpContext, String, String)

Authenticates the request using the specified scheme and returns the value for the token.

SignInAsync(HttpContext, ClaimsPrincipal)

Sign in a principal for the default authentication scheme. The default scheme for signing in can be configured using DefaultSignInScheme.

SignInAsync(HttpContext, ClaimsPrincipal, AuthenticationProperties)

Sign in a principal for the default authentication scheme. The default scheme for signing in can be configured using DefaultForbidScheme.

SignInAsync(HttpContext, String, ClaimsPrincipal)

Sign in a principal for the specified scheme.

SignInAsync(HttpContext, String, ClaimsPrincipal, AuthenticationProperties)

Sign in a principal for the specified scheme.

SignOutAsync(HttpContext)

Sign out a principal for the default authentication scheme. The default scheme for signing out can be configured using DefaultSignOutScheme.

SignOutAsync(HttpContext, AuthenticationProperties)

Sign out a principal for the default authentication scheme. The default scheme for signing out can be configured using DefaultSignOutScheme.

SignOutAsync(HttpContext, String)

Sign out a principal for the specified scheme.

SignOutAsync(HttpContext, String, AuthenticationProperties)

Sign out a principal for the specified scheme.

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)
Obsolete.

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

Applies to