Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8661555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:31:28+00:00 2026-06-12T16:31:28+00:00

we have a web service for some numerical computing. It has a registered mode,

  • 0

we have a web service for some numerical computing. It has a registered mode, in which a user has to register to have its results sent by mail.

We would like to keep track of how long the user stays logged. The login time is written in the database upon successful registration. Registration in not permanent, it’s just for the purpose of single session and is used for acquiring the user email.

There are a few situations possible:

User logs out normally via the logout button.
Simplest solution. Write the time and logout in the database, and delete session.

User logs out by session expiry.
I’m planning on having a script which would check all the database entries which don’t have a set logout time and if current time – login time > expiry time write logout time in a database as login time + expiry time.

User logs out by browser close.
The sessions have a get_expire_at_browser_close() set to True. But i don’t know how can the server detect browser closure.

Ideas, critics, comments?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:31:29+00:00Added an answer on June 12, 2026 at 4:31 pm

    In django session middleware these lines control session expiration if we want that SESSION_EXPIRE_AT_BROWSER_CLOSE:

    if settings.SESSION_EXPIRE_AT_BROWSER_CLOSE:
        max_age = None
        expires = None
    

    Server doesn’t have to do detect anything as cookie that has no max_age or expires set should be deleted on the client side, according to this page:

    By setting either of these, the cookie will persist until its time runs out, otherwise—if you set neither—the cookie will last until you close your browser (a “session cookie”).

    Edit:

    One way of tracking how long user was online is by using javascript that will ping server every now and then. It will happen only as long as the user has page opened in browser and on every ping server should update last seen online value for the user.

    When user closes browser session is over. Next time user logs in server can calculate duration of his last visit as last seen online – last login time.

    Simpler solution without using any javascript: last seen online could be updated on every user request using simple custom middleware.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a web service which returns some data and am trying to
I have a web service , i add some extra class which have message
I have created a web service which is saving some data into to db.
I have some types which are generated by a web service reference. I want
I made a Web service in which I have a function to count some
I have some web service + some shell scripts which I want to execute
I have a web service which queries the cloud for some data and then
First, let me start with some background: I have a web service which accepts
I have a Servlet container (Glassfish/OC4J) which service some JAX-WS web service endpoints which
I have a web service method where I would like to throw some custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.