Home > ASP.NET > Session State Modes in ASP.NET

Session State Modes in ASP.NET

Normally You will configure the session in Web.Config or in code behind. In web config session state is configured with the the element <Sessionstate>. In that there are lot of attribute are there like Mode, Timeout, StateConnectionString, CustomProvider, cookieless, cookieName,allowCustomSqlDatabase,useHostingIdentity etc…

ASP.NET session state supports several storage options for session variables and identified
as session-state Mode.

1) Custom
2) InProc
3) Off
4) SQLServer
5) StateServer

The default sessionMode=’InProc’.
a) InProc mode:- which stores session state in memory on the Web server. This is the default.

Note:- If you enable Web-garden mode by setting the webGarden attribute to true in the processModel element of the application’s Web.config file, do not use InProcsession state mode. If you do, data loss can occur if different requests for the same session are served by different worker processes.

b) StateServer mode:- which stores session state in a process, referred to as the ASP.NET state service, that is separate from the ASP.NET worker process or IIS application pool. Using this mode ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm

c) SQLServer mode:- stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. To use SQLServer mode, you must first be sure the ASP.NET session state database is installed on SQL Server. You can install the ASP.NET session state database using the Aspnet_regsql.exe tool

d) Custom mode:- which enables you to specify a custom storage provider.

e) Off mode:- which disables session state.

More about:- SesionMode Clickhere

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: