开发者

Session Variable Not Being Updated? ASP.NET

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开发者_JAVA百科 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!


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜