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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

No... but you can abandon the session which will recreate a nwe session. Thus will help if you are maintaining user state in session objects.


However i wonder where exactly you will call this code. Need more info on what exactly you define "user laves the page"

acaracioloAuthor Commented:
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 (Lord please tell me no such place exsits) or 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.

acaracioloAuthor Commented:
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
no they won't .... you have to assign the values ..

for e.g.

Dim strSort

strSort = Requesst.Form ("sort")


<form ... >
<input type=hidden value="<%=strSort%>">

Now using above code your selections will be retained across searches ... and will reset to default when the user comes back to your search page from another site.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.