p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Session Anyone


Message #1 by "Ahmed Barradah" <havana200@h...> on Fri, 13 Jul 2001 06:58:32
Put some javascript in that will popup a message box after 180 seconds.
You need the timer to run on the client-side, because the ASP is processed
entirely on the server before anything is sent to the client. Once the ASP
has finished, you can't use it later to process the running of time.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Ahmed Barradah" <havana200@h...>
To: "Code Clinic" <proasp_codeclinic@p...>
Sent: Friday, July 13, 2001 6:58 AM
Subject: [proasp_codeclinic] Session Anyone


:
:
:  Hi,
:    I would like to write a code for my ASP page to set up some time
: constraint on each session say 5 minutes for each user and just about 3
: minutes before the time out I would alert the user that they are going to
: be logged out in 3 minutes, otherwise they will be directed to another
: page to be logged out automatically. I have set up the Session.Timout in
: global.asa to be 5 minutes. However, I would like to have this checkup
: running countinously even if the user stay on one page for the rest of the
: 5 minutes. It is something similar to what haapen when you login to a back
: online. Here is the code I came with but it just do the checkup when the
: user access the page but not after that besides it doesn't do it
correctly:
:
: <%
:    dim logOnTime
:    dim CurrentTime
:
:    logOnTime = Session("start")
:    CurrentTime = Time
:    if (CurrentTime - LogOnTime) >= 3 Then %>
:
: <SCRIPT language="JavaScript">
: <!--
:       alert("You have got 2 minute left before you session ends.");
: file://-->
: </SCRIPT>
:
:    <% Else if (CurrentTime - LogOnTime) <= 0 Then %>
:
: <SCRIPT language="JavaScript">
: <!--
:       alert("Your Session Time is expired. Please login again to if you
: are not done yet. Bye");
:       window.location="End.asp"
: file://-->
: </SCRIPT>
:
: <%
:    End If
:    End If
: %>
:  I would appreciate any comments or suggesstions in how to approach this
: problem and make my web site more professional.
:
:  Thank you
:
:
: ---
: * Fast, Full-Featured Microsoft® Excel Web Reports & Charts!
: A breakthrough in high performance Web application development,
SoftArtisans
: ExcelWriter 1.1 supports native Excel charting, image insertion, and
: advanced functions & formatting. One click generates presentation-quality
: Excel spreadsheets-and ExcelWriter performs over 100 times faster than the
: Excel Object. Several editions, including ExcelWriterFREE, are available.
: http://www.softartisans.com/softartisans/excelwriter.html>
:
$subst('Email.Unsub')


  Return to Index