Wednesday, October 29, 2008

Client Side State Management

  • State Management is retaining some value in the server and reusing that value.We have Client Side and Server Side state management.
  • Http is a stateless protocol, it gives current response for a current request means it will not maintain the previous state.Once the response is given the process of request is deleted.
  • Due to this disadvantage of http we go for State Management.
  • Hidden input fields like are sent back as name/value pairs in a Form POST exactly like any other control,except they are not rendered.
  • Viewstate is client side State Management.
  • The datatype of viewstate is "statebag".
  • Viewstate for every web browser is different.It is used for posting roundtrips of the same form,not for refreshing or resending the same request.
  • It is a property of a page so it is page level.
  • It has both Key/Value pairs like the session object,but renders itself as a hidden field with the name"__VIEWSTATE" like this
  • ViewState serailizes the objects with a special binary formatter called the LOSFormatter.
  • LOS stands for Limited Object Serialization.It serializes any kind of object, but it is optimized to contain strings,arrays, and hashtables.
  • ViewState can store custom object and can be programmed in client.
  • QueryString is client side State Management.
  • QueryString used for passing data from one page to another page.
  • Incredibly simple and often convenient if you want your URLs to be modified directly by the end user.
  • It can pass/send little data only that is it cannot hold lot of information.
  • Inappropriate for sensitive data.Easily modified by the end user.
  • Cookie is also a client side State Management.
  • Cookies should be used only to store non-sensitive information or information that can be retrived from an authoritative source.
  • Cookie has a time out which has default time as 30 minutes which means the coookie expires after 30 minutes.
  • Cookies are passed back and forth on every request.That means you are paying for the size of your cookie during every HTTP GET and HTTP POST.
  • Cookies can be stolen,sniffed, and faked.
  • Your application should attempt to heal itself if cookies are found missing or if they are larger than excepted.

No comments: