hi, i have some problem with session

Discussion in 'ASP General' started by Mikael Hellström, Apr 13, 2004.

  1. 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
    Mikael Hellström, Apr 13, 2004
    #1
    1. Advertising

  2. Mikael Hellström

    Steven Burn Guest

    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)


    Mikael Hellström <> wrote in message
    news:yLWec.89628$...
    > 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
    >
    >
    Steven Burn, Apr 13, 2004
    #2
    1. Advertising

  3. Mikael Hellström

    Ray at Guest

    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


    "Mikael Hellström" <> wrote in message
    news:yLWec.89628$...
    > 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
    >
    >
    Ray at, Apr 13, 2004
    #3
  4. 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



    "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    message news:%...
    > 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
    >
    >
    > "Mikael Hellström" <> wrote in message
    > news:yLWec.89628$...
    > > 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
    > >
    > >

    >
    >
    Mikael Hellström, Apr 13, 2004
    #4
  5. Mikael Hellström

    Ray at Guest

    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

    "Mikael Hellström" <> wrote in message
    news:xbXec.55954$...
    > 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
    >
    >
    >
    > "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    > message news:%...
    > > 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
    > >
    > >
    > > "Mikael Hellström" <> wrote in message
    > > news:yLWec.89628$...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
    Ray at, Apr 13, 2004
    #5
  6. 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




    "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    message news:...
    > 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
    >
    > "Mikael Hellström" <> wrote in message
    > news:xbXec.55954$...
    > > 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
    > >
    > >
    > >
    > > "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    > > message news:%...
    > > > 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
    > > >
    > > >
    > > > "Mikael Hellström" <> wrote in message
    > > > news:yLWec.89628$...
    > > > > 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
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Mikael Hellström, Apr 14, 2004
    #6
  7. Mikael Hellström

    Steven Burn Guest

    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)


    Mikael Hellström <> wrote in message
    news:Z45fc.89661$...
    > 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
    >
    >
    >
    >
    > "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    > message news:...
    > > 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
    > >
    > > "Mikael Hellström" <> wrote in message
    > > news:xbXec.55954$...
    > > > 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
    > > >
    > > >
    > > >
    > > > "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    > > > message news:%...
    > > > > 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
    > > > >
    > > > >
    > > > > "Mikael Hellström" <> wrote in message
    > > > > news:yLWec.89628$...
    > > > > > 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
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Steven Burn, Apr 14, 2004
    #7
  8. Mikael Hellström

    PW Guest

    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>
    PW, Apr 14, 2004
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Smythe
    Replies:
    3
    Views:
    1,223
    Jeff Smythe
    Jan 2, 2004
  2. Eric
    Replies:
    2
    Views:
    1,382
    Tommy
    Feb 13, 2004
  3. dolphin
    Replies:
    3
    Views:
    359
    rossum
    Mar 9, 2007
  4. =?Utf-8?B?Um9iSEs=?=
    Replies:
    4
    Views:
    5,247
    =?Utf-8?B?Um9iSEs=?=
    Apr 11, 2007
  5. Zach Dennis
    Replies:
    2
    Views:
    145
    Joel VanderWerf
    Jan 8, 2004
Loading...

Share This Page