Chris Soe's Blog


Apr 06

Using ASP.NET State Server Session

Intro

Using State Server, session is serialized and stored in memory in a separate process (aspnet_state.exe). State Server can run on another machine.

Main advantages of using State Server session over the default In-proc session:

  1. Session is persistent, you dont need to afraid your session data is lost during application restarts
  2. Avoid Session Timeout due to memory shortage on server (IIS Setting)

Some disadvantages:

  1. Performace overhead compared to In-Proc session (when storing data of basic types like string, integer, etc.)
  2. Object needs to be serialized. Serialization/deserialization can affect performance if you’re storing lots of objects.

Steps to implement State Server session in your web application:

Step 1:  Start ASP.NET State Servcie

  1. Go to Control Panel > Administrative Tools > Services 
  2. Select ASP.NET State Service.
  3. Right Click on ASP.NET State Service and choose start from popup menu.

Step 2:  Change Session Mode in Web.Config File

Step 3: Make All Object Serializable

Sources:

  1. http://www.eggheadcafe.com/articles/20021016.asp
  2. http://dotnetguts.blogspot.com/2009/06/steps-for-session-inproc-mode-to.html

Next Entry Previous Entry