hi, i have some problem with session

M

Mikael Hellström

Hi,
I have a site with a lot off online users. I have a special frame that show
all logged in members and i update this frame in a minute intervall to
catch any mewly logged in members.

My problem is...i use a session time out set to 20 minutes. But the session
never dies. This must be a side effect off the timer i use.

How can i solve this problem? Any suggestion? I must kill session if the
member leaves without logg out.

Regards Mikael
 
S

Steven Burn

I wrote a function that logged people out after a set period of time (60
mins), but unfortunately, it kept booting everyone after the set period of
time (active or not), so if you manage to find an answer to this, I'd also
welcome it.

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
R

Ray at

How are you tracking the list of users logged in? In an application
variable? In a database? Do you have logout functionality? Need more
info. Are you using global.asa with a SEssion_OnEnd to change the flag,
wherever that may be?

Ray at work
 
M

Mikael Hellström

Hi, more info...
I track the on-line user in a database (sql-server 2000).
When the loggen in user press loggout button i call session.abandon.

In my global.asp i have code in (Session_OnEnd )that delete the user from
the data base.
Before i use the timer the system worked soo fine. When the people fall a
sleep he automatic
where deleted from db.

This system works great for me until i started to use the timer to update my
online list.
The update system with the timer is ruin everything here...

Question. How can i solve this on some way??

Regards Mikael
 
R

Ray at

If you refresh the page every minute, and the person falls asleep, he will
remain logged in. Because, every time that page is refreshed, that
reaffirms his continued session. How can you get around this? You could
not use sessions and just use only your "session" tracking that you're using
in your SQL database. You'd want to keep track of the time of his last
action in the database then so that you can tell when someone should be
logged out automatically. Then have a job that runs in SQL to clear out
"sessions" that haven't been used in over 20 minutes.

Ray at work
 
M

Mikael Hellström

Hi,
Could this work?


When the user logged in and every move he takes i set

session("last_move")=now()



Then in the frame with timer i run this code

if timeDiff(session("last_move") , now() )>20 then
session.abandon
end if

Regards mikael
 
S

Steven Burn

Use Time() instead of Now()

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
P

PW

I saw this global.asa example on the web somewhere a long time ago. Its
been working fine for me.

<script language=VBScript runat=Server>
Sub Application_OnStart
Application("active") = 0
End Sub
Sub Application_OnEnd
'---nothing here
End Sub
Sub Session_OnStart
Session.Timeout = 20
'---lock Application variable before updating
Application.Lock
Application("active") = Application("active") + 1
Application.Unlock
End Sub
Sub Session_OnEnd
Application.Lock
Application("active") = Application("active") - 1
Application.Unlock
End Sub
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top