CompressionEnabled Property in session state in asp.net 4.0

Posted By  jalpesh On 16 Jun 2010 08:06:41
emailbookmarkadd commentsprint
No of Views:671
Bookmarked:0 times
Votes:0 times

Introduction

As a web developer we all know about session. Without the use of session any database driven web application is incomplete. As we all know unlike windows form web forms are state less so when user interacts with web application we need to maintain state amongst web pages and we are using session for maintaining state between web pages for each users. ASP.NET is also provide same kind of session state functionalities

ASP.Net Session state identify request coming for same user and same browser for specific session time out interval and its preserves values in session for that specific time intervals and that’s help us in maintaining state amongst web pages for a specific user.

ASP.NET Session state allows us to store session in three way 1. IncProc 2. Session State Service 3. SQL Server. In SQL Server mode it will store session in SQL Server tables instead of storing it in Server Memory. ASP.NET 4.0 provides a new property called Compression Enabled that means when we store values in serialized form in SQL Server with GZip Compression and that results in better performance.

For that you need to store property in web.config like following.

<sessionState allowCustomSqlDatabase="true"  sqlConnectionString="data source=Server;Initial Catalog=aspnetsessionstatedb" compressionEnabled="true" />

 That’s it now with the use of this property you can have better performance when you are storing large amount of data in session.But still you need to decide that why you want to stored large amount of data in session because its against best practices.

Sign Up to vote for this article
Other popular Tips/Tricks
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top