Page 1 has the flowing code logic when pressing a button
If MyDataIsValid() Then
ScriptManager.RegisterStartupScript(me, me.GetType(), "PopUp", "", False)
Response.Redirect("~/Page2", false)
Else
ScriptManager.RegisterStartupScript(me, me.GetType(), "PopUp", <some js for a popup>, False)
End If
If the fist time I press the button and the data is not valid then then popup will show. The second time I use valid data and the page redirects to Page2. If I navigate backwards by pressing the back button on the browser, the popup will show. That's the problem, the popup will falsely tell me my data is not correct.
I know I can make a button on Page2 to redirect me to Page1 but I also want the back button of the browser to work correctly.
When navigating backwards using the browser back button the Load event in Page1 does not run. The page loads the cached page of the first time I press the button.
I tried
Response.Cache.SetCacheability(HttpCacheability.NoCache)
or the
Response.Buffer = true
Response.CacheControl = "no-cache"
Response.AddHeader("Pragma", "no-cache")
Response.Expires = -1441
so the page will no cache but it dos not work. The page does not reload at back button from the browser.
<some js for a popup>and the form. Also, please add the appropriate application tag.. I'm getting the impression this is a webform, is that right? - Brett Caswell