Enabling Session State Compression in ASP.NET 4.0
- In Process - Stored in the same ASP.NET Process
- Out of Process - Stored in the database or in some other system
<sessionState mode="SQLServer" stateConnectionString="some connection string..." compressionEnabled="true"/>
In ASP.NET, Session is a server-side state management technique that helps you to preserve user specific data in memory so that they can be accessed and used when required. If the data that is to be stored in the session is large, it would consume more server resources. Now, Session data can be stored in either of the following two modes:
- In Process - Stored in the same ASP.NET Process
- Out of Process - Stored in the database or in some other system
ASP.NET 4 now comes with in-built support for compressing Session data for storing out-of-process sessions. To enable this feature, just set the compressionEnabled attribute to "true" as shown in the code snippet below:
<sessionState mode="SQLServer" stateConnectionString="some connection string..." compressionEnabled="true"/>

