Link to home
Start Free TrialLog in
Avatar of Coast Line
Coast LineFlag for Canada

asked on

Using Session for a speicifc Pages

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
Avatar of gdemaria
gdemaria
Flag of United States of America image

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

Avatar of Coast Line

ASKER

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


ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i like your this idea, let me implement it and get back to you what happens in this scenario nd its aftereffects

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.

Hows it going?