I have a webforms page that makes quite extensive use of AJAX. There are a number of links on it that take the user off to a different page. I want to maintain the state that the page was in should the user come back to it using the browser's back button.
How I've gone about this is to store the page's state in session each time the user interacts with the page. When they return to the page, if a state exists in session, it is loaded and displayed to the user.
I have this "sort of" working. The page is saved correctly, and can be loaded correctly, but unfortunately requires a page refresh (F5) to load it, otherwise it falls back to a previous state.
Any idea why the page is not being rendered correctly without a refresh? How can I go about solving this?
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (!Page.IsPostBack)
{
DataBindDropDowns();
if (HasQueryString())
{
SetOptionsFromQueryString();
SavePageToSession();
Response.Redirect("Default.aspx");
}
else
{
RestoreFromSession();
DisplayOptions();
}
}
}