acaraciolo
asked on
Session Expire when leaving page
I there a qucik way to expire a session if the user leaves the page, even if they come back before the default time out.
ASKER
The page displays a database of information. The user can select criteria to limit the number of records (a certain manager, a specific date, period, etc) or the user can sort on any of the columns. Whenever the user does this submits a selection or sorts a column the data is resubmitted. The session variable allows me to sort the data without resubmitting the selectables i.e. if a user selects manager A the page resubmits with only manager A's information. If the user then sorts by week ending date the Session variable insures that it doesn't reubmit the entire database.
I guess what I'm asking is if the user say is viewing manager 'A' for wkEndDate #3/18/2006#, then for whatever reason goes to NakedManagers.com (Lord please tell me no such place exsits) or yahoo.com or whatever... and returns to the database page I want the view to be the default (All records) even if he returns before the timeout value???? If that makes sence.
I guess what I'm asking is if the user say is viewing manager 'A' for wkEndDate #3/18/2006#, then for whatever reason goes to NakedManagers.com (Lord please tell me no such place exsits) or yahoo.com or whatever... and returns to the database page I want the view to be the default (All records) even if he returns before the timeout value???? If that makes sence.
for this you should maintain the state in hidden varialbes instead of sessions....
hidden variablkes are
<input type="hidden" value="Name" name="Sort">
<input type="hidden" value="20" name="Week">
maintain in these hidden elements and make sure you always store the current selected value in them and havethis within the forms opening and closing tags i.e. <form> </form>
This way when the users comes back then these hidden fields will be blank and thus you can apply the default settings.
HTH
hidden variablkes are
<input type="hidden" value="Name" name="Sort">
<input type="hidden" value="20" name="Week">
maintain in these hidden elements and make sure you always store the current selected value in them and havethis within the forms opening and closing tags i.e. <form> </form>
This way when the users comes back then these hidden fields will be blank and thus you can apply the default settings.
HTH
ASKER
yes but then I'd have to rewrite the sort and selection codes otherwise everytime the form submits or the user hits refresh those values would be blank
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Session.Abandon
However i wonder where exactly you will call this code. Need more info on what exactly you define "user laves the page"
Cheers