What are the modes of storing ASP.NET session. What are the ways to maintain state in Asp.Net ?
ASP.NET session and Maintain State in Asp.Net
Hi
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
MuthuMari MRank #5,738 · 288 reputationPosted May 2, 2012, 8:35 AM EDT
ASP.NET Session state is nothing but, it provides a place to store values that will persist across page requests. Values stored in Session are stored on the server and will remain in memory until they are explicitly removed or until the Session expires.
InProc : - Session state is stored in memory space of ASP.NET worker process.
( I.e. Aspnet_wp.exe)
This is the default setting, if the IIS reboots or the windows application restarts then the session state is lost.
State Server :-
Session state is stored outside ASP.NET worker process and is managed by Windows service. Location of this service is specified by stateConnectionString attribute.
Session state is serialized & stored in a separate process ie aspnet_state.exe.(session state stored in a separate computer)
SQLServer :-
Session state is serialized & stored in a Sql server DB.
Session state is stored outside ASP.NET worker process in SQL Server database. Location of this database is represented by sqlConnectionString attribute.
Other ways to maintain state
Hiddenfields,query string, viewstate etc,
1.server-side state management
2.Client side state management
pls refer this url for more info:
http://msdn.microsoft.com/en-us/magazine/cc300437.aspx
http://msdn.microsoft.com/en-us/library/z1hkazw7.aspx
Thanks.
SenthilkumarRank #387 · 6.5K reputationPosted May 2, 2012, 7:53 PM EDT
1) InProc
2) OutProc
3) Sql Server
InProc is default session state management, it will store the session in the processor memory (IIS). The aspnet_wp.exe will have the store mechanism to maintain the state of the session. when every you restart the IIS the session will be expired.
OutProc is another session state mode, it will store the session on the aspnet_state.exe, it can be local or remote where multiple application can share the same session.
SqlServer is store the session on the database table, where it needs serialization and deserialization every retrieve and store.
Session can be maintained in client and server
1) Client:
- Cookies
- Hidden Fields
- Query string
- View state
- Control state
2) Server:
- Session state
- Application state
- Database
Hope this will help you.