--- title: Request Features in ASP.NET Core author: ardalis description: Learn about web server implementation details related to HTTP requests and responses that are defined in interfaces for ASP.NET Core. ms.author: riande ms.custom: mvc ms.date: 10/11/2021 uid: fundamentals/request-features --- # Request Features in ASP.NET Core By [Steve Smith](https://ardalis.com/) The `HttpContext` API that applications and middleware use to process requests has an abstraction layer underneath it called *feature interfaces*. Each feature interface provides a granular subset of the functionality exposed by `HttpContext`. These interfaces can be added, modified, wrapped, replaced, or even removed by the server or middleware as the request is processed without having to re-implement the entire `HttpContext`. They can also be used to mock functionality when testing. ## Feature collections The property of `HttpContext` provides access to the collection of feature interfaces for the current request. Since the feature collection is mutable even within the context of a request, middleware can be used to modify the collection and add support for additional features. Some advanced features are only available by accessing the associated interface through the feature collection. ## Feature interfaces ASP.NET Core defines a number of common HTTP feature interfaces in , which are shared by various servers and middleware to identify the features that they support. Servers and middleware may also provide their own interfaces with additional functionality. Most feature interfaces provide optional, light-up functionality, and their associated `HttpContext` APIs provide defaults if the feature isn't present. A few interfaces are indicated in the following content as required because they provide core request and response functionality and must be implemented in order to process the request. The following feature interfaces are from : : Defines the structure of an HTTP request, including the protocol, path, query string, headers, and body. This feature is required in order to process requests. : Defines the structure of an HTTP response, including the status code, headers, and body of the response. This feature is required in order to process requests. :::moniker range=">= aspnetcore-3.0" : Defines different ways of writing out the response body, using either a `Stream`, a `PipeWriter`, or a file. This feature is required in order to process requests. This replaces `IHttpResponseFeature.Body` and `IHttpSendFileFeature`. :::moniker-end : Holds the currently associated with the request. : Used to parse and cache incoming HTTP and multipart form submissions. :::moniker range=">= aspnetcore-2.0" : Used to control if synchronous IO operations are allowed for the request or response bodies. :::moniker-end :::moniker range=">= aspnetcore-6.0" `IHttpActivityFeature`: Used to add `Activity` information for diagnostic listeners. :::moniker-end :::moniker range="< aspnetcore-3.0" : Defines methods for disabling buffering of requests and/or responses. :::moniker-end : Defines properties for the connection id and local and remote addresses and ports. :::moniker range=">= aspnetcore-2.0" : Controls the maximum allowed request body size for the current request. :::moniker-end :::moniker range=">= aspnetcore-5.0" `IHttpRequestBodyDetectionFeature`: Indicates if the request can have a body. :::moniker-end : Adds a property that can be implemented to uniquely identify requests. : Defines support for aborting connections or detecting if a request has been terminated prematurely, such as by a client disconnect. :::moniker range=">= aspnetcore-3.0" : Provides access to the request trailer headers, if any. : Used to send reset messages for protocols that support them such as HTTP/2 or HTTP/3. :::moniker-end :::moniker range=">= aspnetcore-2.2" : Enables the application to provide response trailer headers if supported. :::moniker-end :::moniker range="< aspnetcore-3.0" : Defines a method for sending files asynchronously. :::moniker-end : Defines support for [HTTP Upgrades](https://www.rfc-editor.org/rfc/rfc9110#field.upgrade), which allow the client to specify which additional protocols it would like to use if the server wishes to switch protocols. : Defines an API for supporting WebSockets. :::moniker range=">= aspnetcore-3.0" : Controls if response compression should be used over HTTPS connections. :::moniker-end : Stores the collection for per request application state. : Parses and caches the query string. :::moniker range=">= aspnetcore-3.0" : Represents the request body as a . :::moniker-end : Parses and caches the request `Cookie` header values. : Controls how response cookies are applied to the `Set-Cookie` header. :::moniker range=">= aspnetcore-2.2" : This feature provides access to request server variables such as those provided by IIS. :::moniker-end : Provides access to an with scoped request services. : Defines `ISessionFactory` and abstractions for supporting user sessions. `ISessionFeature` is implemented by the (see ). : Defines an API for retrieving client certificates. : Defines methods for working with TLS token binding parameters. :::moniker range=">= aspnetcore-2.2" : Used to query, grant, and withdraw user consent regarding the storage of user information related to site activity and functionality. :::moniker-end ## Additional resources * *