TransferState

TransferState | ASP:NET | HTTP
TransferState is a mechanism in the ASP.NET Core framework that allows developers to store and share state between middleware components in a pipeline. It is typically used to transfer information or resources between different middleware components while a request is being processed.

Middleware components are essentially small, modular pieces of code that execute as part of the request-response cycle in an ASP.NET Core application. They are executed in a specific order called the middleware pipeline and can perform tasks such as authentication, routing, caching, and logging. TransferState is a way for middleware components to share data with each other as the request is pipelined.

For example, a middleware component needs to authenticate a user and retrieve some information about him from a database. This information could then be stored in TransferState and passed to other middleware components that need to use it.

TransferState is implemented with a key-value store and is accessed through the ITransferState interface, which provides methods for storing and retrieving data from the store. The TransferState object itself is added to the HttpContext object, which is a collection of information about an HTTP request and response and is available to all middleware components in the pipeline.

Some related technologies in the ASP.NET Core framework include the HttpContext, the IServiceProvider interface, and the IApplicationBuilder interface.

BITS experts have used TransferState in a variety of projects. A selection of case studies and references can be found below.

Development of SEO optimized PWAs

Portal applications are implemented by us as high-performance, SEO optimized Progressive Web Applications (PWA) with ServiceWorker integration and Server Side Rendering (SSR) from a Universal Server. PWA is the state-of-the-art standard for modern, device-independent web applications that can be permanently installed on the client and have the same user experience as device-specific native applications.

Go to Top