Class
HttpContext
Represents an context that is shared in a entire HTTP session.
public sealed class HttpContext : IDisposableInheritance #
Implements #
Inherited Members #
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Properties #
| Name | Description |
|---|---|
| Current | Gets the current running HttpContext. |
| ExtraHeaders | Gets or sets the HttpHeaderCollection indicating HTTP headers which will be added (not overwritten) in the final response. |
| HttpServer | Gets the context HttpServer instance. |
| Interlocked | Gets the atomic numeric operations available for values stored in RequestBag. |
| IsRequestContext | Gets whether the current thread context is running inside an HTTP context. |
| ListeningHost | Gets the ListeningHost instance of this HTTP context. |
| LogMode | Gets or sets an LogOutput mode for this context, which will overwrite the matched route log mode option. |
| MatchedRoute | Gets the matched Route for this context. |
| OverrideHeaders | Gets or sets an HttpHeaderCollection indicating HTTP headers which will overwrite headers set by CORS, router response or request handlers. |
| Request | Gets the HttpRequest which is contained in this HTTP context. |
| RequestBag | Gets or sets a managed collection for this HTTP context. |
| Router | Gets the Router where this context was created. |
| RouterResponse | Gets the HttpResponse for this context. This property acessible when a post-executing IRequestHandler was executed for this router context. |
Methods #
| Name | Description |
|---|---|
| EnqueueDeferredAction(Action) | Enqueues an action that will be executed after the response is sent to the client. This action runs within the same context, with access to all current context properties before disposal. |
| EnqueueDeferredAction(Func<Task>) | Enqueues an asynchronous action that will be executed after the response is sent to the client. This action runs within the same context, with access to all current context properties before disposal. |
| EnqueueDeferredAction(Func<CancellationToken, Task>, CancellationToken) | Enqueues an asynchronous action that will be executed after the response is sent to the client. This action runs within the same context, with access to all current context properties before disposal. |
| EnqueueDeferredAction(Func<CancellationToken, Task>, TimeSpan) | Enqueues an asynchronous action that will be executed after the response is sent to the client, with a timeout after which the action will be cancelled. This action runs within the same context, with access to all current context properties before disposal. |
| GetCurrentContext() | Gets the current running HttpContext. |