Shrinking Session State

Your Ad Here

ASP.NET provides two default options for storing session state across a Web farm:
a session-state provider that invokes an out-of-process session-state server,
a session-state provider that stores data in a Microsoft SQL Server database.
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. When the compressionEnabled configuration option shown in the following example is set to true, ASP.NET will compress (and decompress) serialized session state by using the .NET Framework System.IO.Compression.GZipStream class.

!< sessionState
sqlConnectionString="data source=dbserver;Initial Catalog=aspnetstate"

With the simple addition of the new attribute to the Web.config file, applications with spare CPU cycles on Web servers can realize substantial reductions in the size of serialized session-state data.

Posted in Labels: kick it on |


  1. Muhammad Azeem Says:

    This is a nice article..
    Its easy to understand ..
    And this article is using to learn something about it..

    c#,, php tutorial, Ms sql server

    Thanks a lot..!