What is server-side state management?

Server-side state management:

Server-side option for storing page information tend to have security than client-side options,but they can use more web server resources,which may lead to scalability issues when the size of the information store is large. ASP.Net provides several options to implement server-side state management.

->Higher security than client-side options
->Used more web server resources


Comments

Author: Gaurav Aroraa30 Jan 2009 Member Level: Gold   Points : 2

State Managment

The State or Cache Management is nothing but the way to storing the data in Client-Side and in Server-Side using preity small memory.

There are two major category of the above :

Server-Side State Management




Session State: Its nothing but defined as a period of time shared between the web application and user. Every user has individual session. Items/Objects can be placed into the Session which would only define these object for that user. Session contains key variables which help to identify the related values. This can be thought of as a hash table. Each user would represent a different key node in the hash identifying unique values. The Session variables will be clear by the application which can clear it, as well as through the timeout property in the web config file. Usually the timeout is 20 minutes by default.




Session Variables are stored on the server, can hold any type of data including references, they are similar to global variables in a windows application and use HTTP cookies to store a key with which to locate user's session variables.




The collection of session variables is indexed by the name of the variable or by an integer index. Session variables are created by referring to the session variable by name. You do not have to declare a session variable or explicitly add it to the collection.




Lets get it cleared from following example:




Session[“firstName”] = “Gaurav” //User’s first name

Session[“lastName”] = “Arora” //User’s last name




// Clear the session variable

Session[“FirstName”] = null;




//Clear all Session variables

Session.Abandon();







InProc—Stores Session state in the same process as the ASP.NET process [aspnet_wp.exe].




StateServer—Stores Session state in a Windows NT process, which is distinct from the ASP.NET process[aspnet_state.exe].




SQLServer—Stores Session state in a SQL Server database.




Both in StateServer and SQLServer options, we need to ensure that the objects we cache are serializable as data storages are out-of-process systems. Both these options have impact on the application performance as data retrieval and saving operations take more time when compared to the InProc option. So based on our application requirement we should choose the option that best suits our requirement.







Note:

By default, ASP.NET session state is enabled for all ASP.NET applications.

Author: Gaurav Aroraa30 Jan 2009 Member Level: Gold   Points : 2

State Managment

The State or Cache Management is nothing but the way to storing the data in Client-Side and in Server-Side using preity small memory.

There are two major category of the above :

Server-Side State Management




Session State: Its nothing but defined as a period of time shared between the web application and user. Every user has individual session. Items/Objects can be placed into the Session which would only define these object for that user. Session contains key variables which help to identify the related values. This can be thought of as a hash table. Each user would represent a different key node in the hash identifying unique values. The Session variables will be clear by the application which can clear it, as well as through the timeout property in the web config file. Usually the timeout is 20 minutes by default.




Session Variables are stored on the server, can hold any type of data including references, they are similar to global variables in a windows application and use HTTP cookies to store a key with which to locate user's session variables.




The collection of session variables is indexed by the name of the variable or by an integer index. Session variables are created by referring to the session variable by name. You do not have to declare a session variable or explicitly add it to the collection.




Lets get it cleared from following example:




Session[“firstName”] = “Gaurav” //User’s first name

Session[“lastName”] = “Arora” //User’s last name




// Clear the session variable

Session[“FirstName”] = null;




//Clear all Session variables

Session.Abandon();







InProc—Stores Session state in the same process as the ASP.NET process [aspnet_wp.exe].




StateServer—Stores Session state in a Windows NT process, which is distinct from the ASP.NET process[aspnet_state.exe].




SQLServer—Stores Session state in a SQL Server database.




Both in StateServer and SQLServer options, we need to ensure that the objects we cache are serializable as data storages are out-of-process systems. Both these options have impact on the application performance as data retrieval and saving operations take more time when compared to the InProc option. So based on our application requirement we should choose the option that best suits our requirement.







Note:

By default, ASP.NET session state is enabled for all ASP.NET applications.

Author: Mrs. Meetu Choudhary Nanda11 Feb 2009 Member Level: Gold   Points : 2

State Management is defined as the management of the state of one or more user interface controls such as textboxes, buttons, etc in a Graphical User Interface. In UI programming technique, the state of UI control depends on the state of other UI controls. For example, a state managed UI control such as a command button will be in its enabled state when input fields or the text fields have valid values and the button will be in the disabled state if the input fields are empty or have invalid values.

In ASP.NET applications, hosted in a web server are accessed over the stateless HTTP protocol. As such, if the application uses state full interaction, it has to implement state management on its own. ASP.NET provides various functionality for state management in ASP.NET applications.

Some of them are


Application state

A collection of user-defined variables which are shared by an ASP.NET application are termed as Application state. When the Application_OnStart event fires at the time of loading of the first instance of the applications these variables are set and initialized and are available till the last instance of the application exits. To access the Application state variables the Applications collection is used, which provides a wrapper for the application state variables.

Session state

A collection of user-defined session variables are termed as Session state, which are persevered during a user session. These variables are accessed using a Session Collection. These variables have a unique instance to different instances of a user session for the application. Session variables can be set to automatically destroyed after a definite period of inactive time, irrespective of the session state whether session ends or not. At the client side, a user session is identified either by a cookie or by encoding the session ID in the URL.


ASP.NET supports three modes of persistence for session variables:


In Process Mode
These session variables are maintained within the process of ASP.NET Applications. This is the fastest way, however, in this mode the variables are destroyed when the process is recycled or shut down. This mode is not recommended for critical applications as the application is recycled from time to time.

ASPState Mode
In this mode, A separate Windows service is run by ASP.NET, Which maintains the state variables. This has a negative impact on performance as the state management happens outside the ASP.NET process,on the other hand it allows multiple ASP.NET instances to share the same server state, thus allowing an ASP.NET application to be load-balanced and scaled out on multiple servers.As state management service runs independent from ASP.NET, variables can persist across ASP.NET process shutdowns.

SqlServer Mode
In this mode, the state variables are stored in a database, which are accessible using SQL or SQL Queries. Variables can be persisted across ASP.NET process shutdowns. The advantage of SqlServer mode is it allows the application to balance load on a server cluster while sharing sessions between servers.

View state

Mechanism to manage the state at the page-level is refereed as View state, that is utilized by the HTML pages by ASP.NET applications to maintain the state of the web form controls. The encoded state of the controls are sent to the server at time of form submission in a hidden field known as __VIEWSTATE. The server returns the value back of the variable so that when the page is re-rendered, the controls render at their last state.

Other

Other means of state management that are supported by ASP.NET are cookies, caching, and using the query string.

Author: Mrs. Meetu Choudhary Nanda12 Feb 2009 Member Level: Gold   Points : 2

In computer science, in particular networking, a session is a semi-permanent interactive information exchange, also known as a dialogue, a conversation or a meeting, between two or more communicating devices, or between a computer and user (see Login session). A session is set up or established at a certain point in time, and torn down at a later point in time. An established communication session may involve more than one message in each direction. A session is typically, but not always, stateful, meaning that at least one of the communicating parts need to save information about the session history in order to be able to communicate, as opposed to stateless communication, where the communication consists of independent requests with responses.

Communication sessions may be implemented as part of protocols and services at the application layer, at the session layer or at the transport layer in the OSI model.

* Application layer examples:
o HTTP sessions, which may allow dynamic web pages, i.e. interactive web pages, as opposed to static web pages.
o A telnet remote login session
* Session layer example:
o A Session Initiation Protocol (SIP) based Internet phone call
* Transport layer example:
o A TCP session, which is synonymous to a TCP virtual circuit, a TCP connection, or an established TCP socket.

In the case of transport protocols which do not implement a formal session layer (e.g., UDP) or where sessions at the session layer are generally very short-lived (e.g., HTTP), sessions are maintained by a higher level program using a method defined in the data being exchanged. For example, an HTTP exchange between a browser and a remote host may include an HTTP cookie which identifies state, such as a unique session ID, information about the user's preferences or authorization level.

Protocol version HTTP/1.1 makes it possible to reuse the same TCP session for a sequence of service requests and responses (a sequence of file transfers) in view to reduce the session establishment time, while HTTP/1.0 only allows a single request and response during one TCP session. However, this transport layer session mechanism should not be confused with a so called HTTP session, since it is not lasting sufficiently long time, and does not provide application level interactive services such as dynamic web pages.

for more details visit

http://en.wikipedia.org/wiki/Session_(computer_science)
http://en.wikipedia.org/wiki/Session_(parliamentary_procedure)



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: