Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Anita Morales   on Mar 01 In Asp.net Category.

  
Question Answered By: Sam Anderson   on Mar 01

ViewState is basically encrypted and incorporated as part of 1 hidden field. IT is nothing like a session variable.

The viewstate  of all controls on page  and your own viewstate gets all combined into one hidden field and packed/unpacked transparently.

Look at:
www.learnasp.com/.../pageeventmodel.aspx

Now run the page, i.e.
www.learnasp.com/.../textbox.aspx
several times and enter values and push the buttons. Notice how it always remembers the 3 textbox entries. It could remember the contents of any runat="server" controls, inside form runat="server" tags and anything you manually add to Viewstate.

View the HTML source. Notice the =>
input type="hidden" name="__VIEWSTATE" value="dDwtNDE...">
is how this moves around.

Unlike session state which lives on a server  and consumes memory ViewState is just a HTML hidden field. You could have the browser open and push that button 3 days later and that hidden field mould still do its job with no cost in server RAM.

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on ViewState isnt that the same as SessionVariable Or get search suggestion and latest updates.


Tagged: