Solved

Using Session for a speicifc Pages

Posted on 2011-02-17
7
929 Views
Last Modified: 2012-05-11
I am asking this still i think this would not be possible!

i have application in which session Timeout is 24 hours!

i have 4 pages which i want that session would be 20 minutes, can i do something like this for that spicifc pages, i can use the start to be 20 minutes for only those 4 pages.

Also, i have noticed that cgi.http_referer is null is CF 8 sometimes, can i use the relevant code for this and it will work or not

Please guide
0
Comment
  • 5
  • 2
7 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 34923491
> i have application in which session Timeout is 24 hours

Why do you want a user's session to last so long?  That is very long.  

>  have 4 pages which i want that session would be 20 minutes

The session cannot change for different pages, but if you tell us your goal, we can suggest other ideas how to do what you need to do.   For example, you could create javascript to move away from a page after 20 minutes and redirect you to a logout page.

> i have noticed that cgi.http_referer is null is CF 8 sometimes

the referrer is NULL when someone navigates directly to the page.  When someone clicks on a link and goes from one page to another, it should not be NULL.   What do you want to use this for?  It is not reliable, so use it cautiously.


Again, you should describe the problem you are trying to solve, we can help you with other ideas.

0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 34923550
this is a big issue i ma trying to solve,

session timeout cannot be changed as it is not in my hands, we applied javascript functionaity is some areas where if the user closes the tab or the browser a window.onunload event will be called and entry will be deleted from th DB!

now, this event is fired everytime the window is refreshed or any onChange evet is happenieng!

i am in the process to swicth to some alternative solution for this trouble!

if cgi.http_referer is unreliable can we use the java context which is same as cgi.http_referer

Also, what you say if i swithc from window.onUnload to window.Closed and that will handle only the X Button of the browser and nothing else!

I am considering OnSessionEnd also, if the Browser is Closed, the OnSessionEnd will execute and it will remove the entry from the Db!

Next Isue! We cannot rely properly on Javascript, If you are giving me an option of using javascript timeout of 20 minutes and setting a cookie for that specific page, then i can check for the cookie and that cookie is from the samepage whjioch is being closed, i will fire the evnt..

I know my questions seems very awkward and inrerelavant to you but now i am tuck in a very big trouble!

So guidence is needed here
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 34927017
> session timeout cannot be changed as it is not in my hands

That is too bad, because 24 hours is much too long.  You should talk to the person responsible for this and convince them that this is just wrong.

> we applied javascript functionaity is some areas where if the user closes the tab or the browser a window.onunload event will be called and entry will be deleted from th DB!

Right, that will fire on every page change.  I have seen websites that ask before you leave them, but I haven't been able to find out how.  

> if cgi.http_referer is unreliable

I don't understand how you would use this.  It tells you the page you came from.  How can that help you?  You would have to put code on SOMEONE ELSE's website to test if they just came from your site... it can't help you.

> I am considering OnSessionEnd also

You really need this,  it's one of your only ways to handle it.  However, because of your loooong timeout period, it will not run until the NEXT DAY.   You need to change the 24 hours down to 20 minutes.

>  If you are giving me an option of using javascript timeout of 20 minutes

The timeout after js 20 minutes can redirect your page to a logout page and end your session.  


0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 39

Accepted Solution

by:
gdemaria earned 100 total points
ID: 34935492
How about we look at this another way.

What if you update the user's record in the database every time they view a page.  Update the "LastActionDate" to the current date, every time they view a page.

Then setup a scheduled task to run every 5 minutes and look for users whose last action date is only than 20 minutes.  Then you can delete their records because they have not done anything for 20 minutes.

This is similar to my sugestion above that you can track the time of the lock and delete any that are old.
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 34935649
i like your this idea, let me implement it and get back to you what happens in this scenario nd its aftereffects
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 34935726

You have never really said what you need to do when the session is closed.   If you say your goal, we can help you acheive it.  We've only been discussing your idea of how to handle it.   There may be other ways.

If your goal is just to clear the locks, then use the last access date on the lock record and delete the locks after they have been untouched for 20 minutes.

If you have other goals, let us know what they are.
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 34960916

Hows it going?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Every business owner understands the significance of online customer reviews and the impact it can have on sales and revenues. With technology advancing at such a rapid pace, getting online reviews has never been easier, especially when many regions…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now