Jan 02, 2015 12:44 AM|sumeetssm|LINK
i have a situation in what the user will keep a page/form open for couple of hours/days. After that time when the user comes to the page, even if i check cookies, i get other login variables, but the state of the controls is lost. Now when user clicks refresh,
instead of postback, a fresh request is made.
I have read a lot and found that the viewstate is itself stored in the session. so when the session expires the viewstate is gone.
How do i retain the viewstate, so that the selections remain the same the page refreshes.
Now i cannot store the current values of the selected fields in cookies as i have to apply this logic to a hell lot of pages.
Lets first talk about only Single page.
The code below is useless, but is something that i was using.
if (ViewState["AdminFlag"] != null)
Session["AdminFlag"] = ViewState["AdminFlag"].ToString();
if (Session["AdminFlag"] != null)
Admin_Flag = Session["AdminFlag"].ToString();
Master.ChkLogin();//checks cookies and populates to session