Why ViewStates instead of Sessions

why do we use to store data in ViewState? even if we do the same job Session?

Session["Data"]

against.

ViewState["Data"]     

Who cares?

+4
source share
3 answers

Sessiondata is valid only if the current session is active. Typically, a server deletes a session after half an hour or so. ViewStateavailable even if the session has expired and you still have a page on the screen. This content is serialized in the view and sent over the network each time you open the page, or send formback.

: , , , , . , .

0

ViewState , , __ViewState Base64

, , ( 20 ) Session.Abandon() ,

, , .

ViewState, ​​ .

+1
**Session**



Session state is maintained in session level.

  Session state value is available in all pages within a user session.
    - 
  Session state information stored in server.
    - 
  Session state persist the data of particular user in the server.
    This data available till user close the browser or session time
    Completes.
    -
 Session state used to persist the user-specific data on the server
    Side

View state

    View state is maintained in page level only. 
    View state of one page is not visible in another page.        
    View state information stored in client only.       
    View state persist the values of particular page in the client
  (browser) when post back     operation done.
+1
source

Source: https://habr.com/ru/post/1570859/


All Articles