[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Meassure the duration of a user login/session

Posted on 2006-04-19
Medium Priority
Last Modified: 2006-11-18
Hello folks

Im developing a webappliation that people will pay for the time that they use it.

What is the best way to meassure how long time a user is loged in ?

At first I thougth that session_start and session_end would help me, but if the users just closes the browser the session will not be ended until the session time out limit is reached(im well aware that the www is stateless=. Is there any realiable solution on this problem or is there a total different approach to this problem ?

Thanks for any ideas.

Best regards


Question by:holtis
  • 3
  • 2
LVL 15

Expert Comment

ID: 16485729
There is no reliable solution.

Depending on what the site does you could change your Session timeout from the default 20 minutes to 2 minutes and then when they sign up they have to agree to pay the extra 2 minutes if they close their browser.

As you are aware it is stateless which makes this type of business plan more difficult to enforce.

You could write the entire site in something like Macromedia Flash which as far as I am aware is not completely stateless. (I could be wrong though).

Your other option would be to get the site to call an AJAX control every minute and once that request does not come through for a minute clsoe the session and send the bill


Author Comment

ID: 16485794
Ajax could be a possiblity but how reliable would this be ?

One approach could be that one set a time out limit to 20 minutes, on each page request you confirm to the billing database that this session is still acitve(could be a field like "lastupdate") and on each page one could integrate a ajax call that would confirm that the session is still active.

This would mean that when ever the browser is closed we would still know how long the session was active. What would be the main disadvantages of this solution ?

Can a user some how stop the ajax calls(by using the stop buttom in the webbrowser)?
LVL 15

Expert Comment

ID: 16684146
If you enforced Javascript to view the page then it shouldbe quite reliable.

They cannot call stop, however they can process all requests through a personal proxy and stop it there...
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 15

Expert Comment

ID: 16867378
Decent solution offered.

Author Comment

ID: 16940226

Sorry not for replying earlier. None of the ideas really lead to a solution. However this thread can be closed.

Best regards

Accepted Solution

GranMod earned 0 total points
ID: 16968196
PAQed with no points refunded (of 500)

Community Support Moderator

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

872 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