Hello all,
Hoping you can give me some opinions on how best to handle some session variables. I don't want to be too long-winded about this, so I am going to skip the long drawn out explanation of what I am trying to do and just boil this down to my dilemma.
Say I have a web application that allows users to do all sorts of things with no particular order or work flow. Sometimes, a user is going to be coming from a page where they entered some stuff, and they may want that stuff carried over.
So say I have 3 session variables (one holds a flag, the other two hold data). I set the flag to 0 at log-in and I set it to 1 when they hit the page where they enter relevent data. Now, if they want to go onto to page where they will use said data, I want to put a form that will set the two session variables that hold the data and set the flag to 1. Then they can click a submit button to take them to the page where they will use the data. After they use the data, I want to destroy the two data variables. (Which I think I can do by doing a Contents.Remove for those variables, or something like that. I am hazy on the details but I can work that out.)
My dilemma is what to do with those two variables (and the flag, which will have to get set back to 0) if the user goes anywhere else other than the relevent page. I have three possible solutions that I need advice on:
1. Is there a way to create those two session variables only if the form is submitted?
2. I could put code on the top of every other page to check the flag, and if it is set to 1, to set it to 0 and destroy the two other variables, but I have alot of pages, so this would be a major change.
3. Is there a way to set a timeout value just for those two variables so that just they will timeout after 5 or 10 minutes?
Any advice will be greatly appreciated.
Thanks,
Ann
Hoping you can give me some opinions on how best to handle some session variables. I don't want to be too long-winded about this, so I am going to skip the long drawn out explanation of what I am trying to do and just boil this down to my dilemma.
Say I have a web application that allows users to do all sorts of things with no particular order or work flow. Sometimes, a user is going to be coming from a page where they entered some stuff, and they may want that stuff carried over.
So say I have 3 session variables (one holds a flag, the other two hold data). I set the flag to 0 at log-in and I set it to 1 when they hit the page where they enter relevent data. Now, if they want to go onto to page where they will use said data, I want to put a form that will set the two session variables that hold the data and set the flag to 1. Then they can click a submit button to take them to the page where they will use the data. After they use the data, I want to destroy the two data variables. (Which I think I can do by doing a Contents.Remove for those variables, or something like that. I am hazy on the details but I can work that out.)
My dilemma is what to do with those two variables (and the flag, which will have to get set back to 0) if the user goes anywhere else other than the relevent page. I have three possible solutions that I need advice on:
1. Is there a way to create those two session variables only if the form is submitted?
2. I could put code on the top of every other page to check the flag, and if it is set to 1, to set it to 0 and destroy the two other variables, but I have alot of pages, so this would be a major change.
3. Is there a way to set a timeout value just for those two variables so that just they will timeout after 5 or 10 minutes?
Any advice will be greatly appreciated.
Thanks,
Ann