How To Deal With Cache and the Browser Back Button

I had a situation where a user makes checkbox selections and the delta of those changes is captured in the CheckedChanged event associated to the checkboxes. After which a confirmation screen is presented displaying their selections.

There was an issue where if users clicked the Back button in their browser and they proceeded to change their selections the CheckedChange events would return odd results.

To solve this I disabled caching, forcing the browser to always go back to the server.

add the following to the onLoad event of the page:

 protected override void OnLoad(EventArgs e)


        // to allow for the CheckedChanged event to work properly: 
        // In a case where a user hits the back button after confirmation
        // never store cached page. Force to get from server
        Response.AppendHeader("Cache-Control", "no-store");


Found here

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s