Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Session Expire when leaving page

Posted on 2006-03-25
5
Medium Priority
?
289 Views
Last Modified: 2008-03-10
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.
0
Comment
Question by:acaraciolo
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:randeeps
ID: 16289976
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.

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
0
 

Author Comment

by:acaraciolo
ID: 16290079
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.
0
 
LVL 10

Expert Comment

by:randeeps
ID: 16290124
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
0
 

Author Comment

by:acaraciolo
ID: 16290425
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
0
 
LVL 10

Accepted Solution

by:
randeeps earned 2000 total points
ID: 16290612
no they won't .... you have to assign the values ..


for e.g.

<%
Dim strSort


strSort = Requesst.Form ("sort")

%>

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


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.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question