I am trying to understand the order of events here.
This page tells me that at some point in the life cycle of the page that the ViewState is mapped to the page session.
I guess this happens in the control. SaveViewState () method .
Can someone tell me when this will happen?
I am worried that I see code that reads ViewState variables in Page_Load, and I think it still returns information even after the session is cleared. (causing the timeout redirection problems we set)
ViewState Init Load 1 PreRender. , Load PreRender.
ViewState != Session. ViewState , , __VIEWSTATE 2. , "" , ( , ;-) .
ViewState != Session
__VIEWSTATE
1 ViewState PreLoad, , . LoadViewState/TrackViewState . ( , .)
2 , - ViewState. / (, ).
ViewState . , .
ViewState
.
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ViewState["abc"] = "10"; } } protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); } protected override void OnInit(EventArgs e) { base.OnInit(e); } protected override void OnInitComplete(EventArgs e) { base.OnInitComplete(e); } protected override void OnPreLoad(EventArgs e) { base.OnPreLoad(e); }
OnPreLoad ViewState. , Init/InitComplete/PreInit, ViewState.
OnPreLoad
, SaveViewState() , LoadViewState() .
SaveViewState()
LoadViewState()
Session ViewState?