Sunday, November 13, 2016

State Management in asp.net - Part 1

State Management in Asp.net:

State Management: To manage the state of Web Pages/ User Data we use the state management technique. The reason to manage state is that browser and HTTP/HTTPs are stateless. Each time when user send request to the web server a new object of the page is created.

We can manage the state at different level:

     1.       Control Level: All controls in asp.net have automatic state management.
     2.       Object or Variable Level: For variable in a page need object or variable level state management.
     3.       Single or Multiple Page Level: In case of page requests
     4.       User Level: Manage state as long as user is active on the application.
     5.       Application Level: Manage state irrespective of user. It will be available to all users.
     6.       Application to Application Level: Manage state among multiple applications.

We can manage the state in asp.net in the following ways:

     1.       Client Side State Management: In this type of state management all information related to state are stored at client machine or in the page user is looking into. Server does not store any information b/w client to server round trip.

There are multiple ways to manage state at client side:

a)      View State

b)      Control State

c)       Hidden Field

d)      Cookies

e)      Query String

    2.       Server Side State Management: In this type of state management all information related to state are stores at server machine. Server sends less information to client.

a)      Application State

b)      Session State

There are three modes (ways) to manage Session State:

i)                    In Proc
ii)                   State Server
iii)                 SQL Server