January 3, 2011

Compress Session State in ASP.NET 4




ASP.NET 4 introduces a new option called ‘compressionEnabled’ to compress session state and improve application performance.

When you are storing session state in a State Server or SQL Server and have set the ‘compressionEnabled’ attribute to true, ASP.NET compresses session-state data. I have heard that internally it uses the GZip stream to compress and decompress session data.

Add the following entry in your web.config file with the compressionEnabled attribute set to true, as shown below:

compressionEnabled web.config

Note: Since Compression and Decompression is involved, your application will consume additional CPU cycles to perform the operation. However compressing session state will lead to better performance of your application.



Giving me +1 tells me you liked this article! Thanks in advance


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

2 Responses to "Compress Session State in ASP.NET 4"
  1. Anand From Dominos Pizza said...
    January 3, 2011 at 3:29 AM

    Compression enabled a new concept pretty interesting.

  2. Fabian Fernandez said...
    January 4, 2011 at 3:25 AM

    Good post!

 

Copyright © 2009-2013 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions