session variables lost for some reason

后端 未结 5 671
说谎
说谎 2021-02-06 17:51

I try to setup a E-shop. Next to every item I\'ve an asp:imagebutton when this imagebutton is clicked I\'m checking whehter the session varialbe session[\"bas

5条回答
  •  暖寄归人
    2021-02-06 18:15

    mesut:

    Honestly Session memory can be very volitile. If the application goes down you can loose it, or like you said, if the user's session gets restarted you can loose it. Generally the options for Asp.Net are to store data in:

    • ViewState (stored as encrypted text accessable by your code-behind)

    • Session Memory (essentially a dictionary, but as above, a little
      volatile)

    • ASP.Net's State Service (which stores the values in a separate process. watch out for server farm scenarios)

    • Cookies

    • Cache

    • Url Parameters

    Each of these methods has a trade-off in terms of performance, memory, or being dependent on a user's environment. I would try a different method and see if that is more robust for you.

提交回复
热议问题