Hi I use Sessions in my application and I was wondering what is the best practice for maintaining session value on a page. I need the value that is stored in the session to be saved until the post back on a particular page. Let me illustrate:
Page A: Page B:
Sets Session["ID"] = 5 --> Gets Session["ID"]
And redirects to Page B and populates data.
I need the Session["ID"] on Page B to stay alive until a post back is performed on Page B. I need this because I will be using the value of Session["ID"] update data in the database.
My question is: Is the any guarantee that the Session["ID"] will maintain its value until a post back is performed? Won't it die? If so: What are some methods I can take to make sure it maintains its value?
I was thinking of making a private variable in Page B to store the Session["ID"] on Page_Load. Please let me know what you think, thank you.
Im sorry I should have said: I cannot allow the user to modify the ID. So no QueryStrings, thanks.