Session State Compression in ASP.NET 4.0

A new feature to ASP.NET 4.0 is session state compression when you use SQL Server or the ASP.NET State Service. These are the two options available for ASP.NET in a web farm. Because both options involve storing state information outside a web application's worker process, session state has to be serialized before it is sent to remote storage. Depending on how much information a developer saves in session state, the size of the serialized data can grow quite large.

ASP.NET 4.0 introduces a new compression option for both kinds of out-of-process session-state providers. ASP.NET will compress and decompress serialized session state.

To enable this update the sessionState in the web.config file:

<sessionState compressionEnabled="true"
mode="SQLServer"
sqlConnectionString="data source=your-server;
Initial Catalog=aspnetstate;User ID=user;Password=password;
"
allowCustomSqlDatabase="true" />

No comments:

Post a Comment