Saturday, 7 December 2013

State Management System in asp.net application


What is State management System in Asp.Net Applications:-
Introduction Of State Management System:-
State management  system means:-It is a concept or a technique for web applications developed   asp.net. Generally web applications are based on  stateless  HTTPprotocol which doesnot  retain any information about user’s request.So for this reason the time of client and server communication using HTTP Protocol, page is created and requested  each time,so Developer is implement different types of state management.
There are two types of state management is available in asp.net application:-
Classification Of State Management:-(Shown in Figure Below):->





Description  Of Client Side  State Management:-
  1>Hidden Field:-
Hidden Field is the Standard Html Control which is allows to store the  informations. It  stores a single variable in its value property and must be explicitly added to the page. When a page is submitted to the server, the content of a hidden field is sent in the HTTP form collection along with the values of other controls. A hidden field acts as a repository for any page-specific information that you want to store directly in the page.All browers supports and  Server resources are not required.
2>View State:-
 View State is nothing but it is the built-in structure for automatically retaining values among  the multiple requests  for  the same page.It is internally maintained as a hidden field on the page.It is also good for caching data in web frame configurations because data is cached on the client.We can store value in view state as well.
3>Cookies:-
Cookies is nothing but it is a small piece of  textual data which is store in side the brouser memory for a temporary period or stored inside the client hard disk for a permanent period.A cookie can store maximum 4kb of data including cookie name.
It is two types
1>session type cooky or Temporary cookie.
2>Persistent cooky or Permanent Cookie.
Session type cooky or Temporary cooky:-
Session cookie is a Type of Cookie which is store in brouser memory for a temporary period,once the brouser is closed the cookie is destroyed.
Persistent cooky or Permanent Cookie:-
 Persistent cookie is a Type of cookie created inside the client hard disk and it will be deleted explicitly by the user or implicitly,whenever expary data encounter.
4>Control State:-
Control state is used to store  data in order  for a control to work properly. The  Control state Responsible to  allows to developer to  persist  property information that is specific to a control and cannot be turned off like the Viewstate  property.
5>Query Strings:-
Query String is nothing but  responsible send the page information  to server.It containing in the HTTP request for specific URL and All browsers support to Query Strings.

Description  Of Server Side  State Management:-
Application State:-
Application state is a global storage mechanism that is accessible from all pages in the Web application. for the use of application state, ASP.Net creates an application state object for each applications from the HTTPApplicationState class.It stores this object in server memory and this object is represented by class file whose name global.asax.By this file the data to be shared across users globally in asp.net application.
Generally There are 6-events  maintained by this  object:-
1>Application_Init:-This Event fired when an application initializes or called first time.
2>Application_Start:- This Event fired when first time the instantiate of  HTTP application class is  created.
3>Application_End:-  This Event fired when first time the instantiate of  HTTP application class is  destroyed.Note it this Event Fired only once during an application’s lifetime.
4>Application_Error:-  This Event fired when any unhandled exception is encounter.
Session State:-
Session state management is a very strong and good technique to maintain state. Generally session state management is used to store user's information and/or uniquely identify a user. The server maintains the state of user information by using a session ID. When users makes a request without a session ID, ASP.NET creates a session ID and sends it both  request and response to the same user. The SessionID is globally unique and random.
The session state object is created from the HttpSessionState class, which defines a collection of session state items.
To manage a session, ASP.NET provides two events:-
Session_Start  and Session_End
1>Session_start:-  This Event fired when a new user  visits this website.
2>Session_End:-  This Event fired when a user leave the website or user’s session become time out.
 session  management can be maintain by 2ways in ASP.NET:
1>Inprocess Session:-This information will be store inside the process where our application running.In this session no need to serialize the data.
2>Outprocess Session:-
       Outprocess Session is two types
1>State Server Session:- This information will be stored using asp.net state service and Faster than Sqlserver Session management.
2>Sqlserver Session:- This information will be stored inside database  and It is good place for storing large  data.

No comments:

Post a Comment