Sunday, August 22, 2010
Session is a server side state management technique in ASP.NET. ASP.NET 4.O provide build in support for compress and decompress serialized Session state, By using this compress session state, you can improve your server performance. Compress option can be used when you are storing large amount of data in Session this will reduce the size of session. Session data can be stored in following two modes.
- In Process
- Store in the same ASP.NET Process
- Out of Process
To enable this feature, you have to set compressionEnable attribute to ture in Session State settings in Web.config.
I have created a Web Site in Visual Studio 2010 as i will consider you know how to create a web site in Visual Studio 2010.
Now i have stored some text in Sessions as shown in below Figure 1.1
Enable compressionEnabled= "true" in Session State of your Web.Config file as shown in below Figure 1.2
Now Load this Page and you will see the out put as i have shown in Figure 1.2
Disable compressionEnabled= "false" in Session State of your Web.Config file as shown in below Figure 1.4
Now Load your page, you will see the Begin Render and End Render time as shown in below Figure 1.5
This example shows that using ASP.NET 4.O new feature you can reduce the work load of your server but this will be effected when you are storing large amount of data.
Compress Session State in ASP.NET 4.O