views:

27

answers:

2

I have a three step wizard. On the first step I use a repeater to create a series of buttons that an individual can select from. When the user selects one of the buttons the value of the button is saved to session state. They are taken to the next step and shown a similar list of buttons that are based on what they previously selected. Thus, if you choose "Hamburger" you might receive the options of "onion", "lettuce", "tomato" while if you choose "Hot Dog" you might receive "sauerkraut" and "ketchup". Lets say an individual chooses Hamburger. This is saved into session state like so:

    Public Sub Button_ItemCommand(ByVal Sender As Object, ByVal e As   RepeaterCommandEventArgs)
    ' ******** Lets pass on the results of our query in LinqDataSource1_Selecting.
    Session("food_select") = RTrim(e.CommandName)
    Wizard1.ActiveStepIndex = 1
End Sub

Now, this works fine and dandy. But lets say I select hamburger and then realize I'm really hankering for a hot dog. I go back to the first wizard step and click on the hot dog button - but when the wizard progresses to the next step I still see the options for hamburgers! The session variable has not been updated. Why? Thanks!

A: 

The session variable was probably updated, but the next page was still cached from the previous time it was accessed.

Make sure your wizard pages are not cached.

Oded
You may be right...How would I go about disabling caching? I have tried putting into Page.Load Response.Cache.SetCacheability(HttpCacheability.NoCache)But that is not making any apparent difference.
davemackey
@davemackey - See this question: http://stackoverflow.com/questions/955792/browser-caching-in-asp-net-application
Oded
@oded hmmm....I took a look at that article and it didn't seem to provide assistance in this particular case - it was more involved with static object caching.
davemackey
@davemackey - This forum thread has more complete info for disabling caching of dynamic pages: http://forums.asp.net/t/1060173.aspx
Oded
A: 

Problem was in checking the session variables too early. I needed to move them later in the page load process - e.g. prerender, then the session variables would be updated.

davemackey