logo
 
  •  
  • Thread Rating
    70.0%
    Rate this Thread
    Double click on boxes to rate this thread
  • Client side state management in ASP.Net
  • Client side state management

    In this type page information is stored on the client side. There are different ways to maintain state on client side
    View state
    Hidden fields
    cookies
    query strings
    control state
    1. View state: It is a in built structure for maintaining the state of a page. Its purpose is to keep the state of controls during subsequent post backs by the same user. It indicates the state of an object at that particular instant of time. It is maintained using hidden fields.

    Advantages:
    a) As it is a client side technique it does not require server resources
    b) It is a in built structure
    c) It is little secured as the values in view state are hashed, compressed and encoded
    Disadvantages
    a) As view state is stored in the page itself, if we store more information in view state it affects the performance of the page
    b) As view state is stored in the page itself we can view its contents when we view the source code.

    2. HiddenFields: This is used to store page specific information in hidden fields.
    This used to store values in html form with out displaying it on the browser.
    We can use these for the page which post backs to itself or to another page.

    Advantages:
    a) As it is a client side technique it does not require server resources.
    b) Most Browsers support this technique
    Disadvantages:
    a) As Hidden Fields is stored in the page itself, if we store more information in
    Hidden fields it affects page performance
    b) Security is less as users can view the information in hidden fields when they
    Open the source code.

    3. Cookies: A cookie is a file stored on users computer containing information Specific one site. Values stored in a cookie are sent to the same server with every page request through browser. Means they are posted back and forth on every request. Generally frequently changing information will be kept in a cookie. Default life time of a cookie on user s machine is 100000 minutes.

    Advantages:
    a) It does not require server resources.
    b) It is very simple to implement
    c) Cookie can expire when browser session ends or it can stay permanently till we apply some expiration rules.
    Disadvantages:
    a) Security is less as users can manipulate cookies on their machines.
    b) Most Browsers allows only cookie with a max size of 4096 bytes
    c) As there is security threat some users may disable their machines capability of receiving cookies thus reducing its functionality.

    4. Query Strings: Query string is the information which we see at the end of the pages Url. Generally it is used to place navigation specific information.
    We can√Ę‚.¨‚.Ęt keep sensitive information using query string.

    Advantages:
    a) It Does not require server resources
    b) It is very easy to implement
    c) Most Browsers support this feature
    Disadvantages:
    a) There is a security risk as it is visible in the browsers address bar.
    b) Using query strings we can√Ę‚.¨‚.Ęt place more information.(2083 character limit)

    5. Control State: This is used to store custom control data between server trips.
    This is used to store small amounts of information of a control between server trips.
    By default it is stored in hidden fields on a page.

    Advantages:
    a) server resources are not required
    b) Easy to implement.
    c) We can√Ę‚.¨‚.Ęt turn off control state at the page level. So, it is more reliable
    Disadvantages:
    a) To use this we need to write code for saving and loading of control state.

    In this type state information will be stored on the server side.
    By Sri - Sep 04 2009 Reply » Save » Print »
  • There is a correction in last line of posting:

    In this type state information will be stored on the Client side, (not on server side).

    Thanks
    Srini
    By - - Sep 04 2009 Reply » Save » Print »

Login to post your reply