Session management in asp.net means how and where session information is saved.
There are three types of session management in Asp.net
1-In process
2-SqlServer
3- State Server
There are three types of session management in Asp.net
1-In process
2-SqlServer
3- State Server
By default all the applications are configured to in process it means that session information is being saved in the same process that application is running. So far so good you do not need change this however you can apply some session configuration like sessiontimeout which is an indicator for asp.net to know howlong should keep a session for user. For example if a user does not send any request to server for longer time than sessiontimeout (which is minutes) then asp.net will kill that session. Or you can make it cookiless it means that it will use query string to notify each session. All of these configuration can be done in web.config with sessionstate tag :
sessionState mode="InProc" cookieless="false" timeout="20"
You do not need to change the mode as long as you have just one server. If you have more than one server to serve your application then you need to use other session management (2 or 3). When your application is big enough and you have a lot of users you need to deploy your application in different servers (it is called webFarme). If you use InProcess approach, you cannot trust on session information the reason is that InProcess means each server has its own session information so imagine a user come to your site the first request goes to one server and second request of the same user will go another server so your session id will be different and second server has no idea about session information in first server. To solve this issue we need save session information in somewhere else rather than in each server. (I am sure everybody knows that to have multiple servers for one application we need load balancing service be installed between those servers).
StateServer:
Saving session information in one server and let other servers use that information from that server to do this you need ASP.NET State Service to be up and running (this service is installed when you install the .NET runtime). By default the service listens over port 42424. To see this service you can go to control panel\ Administrative tools \ services you should be able to find ASP.NET State Service. Using the State Service option is useful when you want out-of-process session state management but do not want to have to install SQL Server on the machine hosting the state. See this sample:
sessionState mode="StateServer" stateConnectionString="192.168.1.103:42424"
SqlServer :
Before using this mode, you must run the InstallSqlState.sql script on the database server where session state will be stored. This script can be found in :
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallSqlState.sql
(if you have another version you can try those ones)
The primary purpose of this script is to create some tables that can store client-specific state indexed by session ID in those tables. After running that script in your database (you do not need specify any specific database just run the query in query analyser in sqlserver)
See this sample:
Microsoft suggest the sql server approach.