Wednesday, July 4, 2007
Session Vs ViewState
Session State is useful for storing values that must be persisted across multiple pages by the same user. ViewState is useful for storing serializable data that must be persisisted across PostBacks by a single page. If you use Session State, the value you insert will remain in memory until (1) The Session times out, or (2) Your code removes it. If you useViewState, the value you insert will remain in ViewState until the user requests a different page.ViewState stores data betwen PostBacks by putting it into a hidden formfield on the client HTML doc. when the doc is Posted Back, the values are read from the hidden form field and stored in memory until the page has finished processing. If ViewState is particularly large (and I'm talking KBshere, not 6 bytes), it can negatively affect the speed at which the HTML docis down loaded by the browser.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment