Re: Handle Session Timeout And Lost MemberID
From: Egbert Nierop \(MVP for IIS\) (egbert_nierop_at_nospam.invalid)
Date: 12/06/04
- Next message: Evertjan.: "Re: Handle Session Timeout And Lost MemberID"
- Previous message: Edward Rothwell: "Handle Session Timeout And Lost MemberID"
- In reply to: Edward Rothwell: "Handle Session Timeout And Lost MemberID"
- Next in thread: Evertjan.: "Re: Handle Session Timeout And Lost MemberID"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 6 Dec 2004 14:53:51 +0100
"Edward Rothwell" <edward.rothwell@hale-it.co.uk> wrote in message
news:%23wYkZ042EHA.1392@tk2msftngp13.phx.gbl...
>I have a web site where once a user has logged on I store
> their MemberID in a global variable in the global.asa file.
>
> Then in other pages I find out which member I am dealing
> with by looking at this variable, ie:
If IsEmpty(lgMemberId) Then
... timeout
Else
Increasing the timeout might fix this but if you deal with lots of users,
you should avoid to waste lots of resources.
> <%
> Private lgMemberID
>
> lgMemberID = Session.Contents("MemberID")
>
> %>
>
> I then use this variable to query a database...
>
> Sub WriteMessages()
> Dim strFirstName
> Dim strSurname
> Dim bPhone
> Dim bCard
> Dim bEMail
> Dim strSQL
> Dim rs
>
> strSQL = "{CALL qGetMessages (" & lgMemberID & ")}"
>
> Set rs = Server.CreateObject("ADODB.Recordset")
> rs.Open strSQL, conn, 3, 3
>
> Do Until rs.EOF
> strFirstName = rs("ContactFirstName")
> strSurname = rs("ContactSurname")
> bPhone = rs("Phone")
> bCard = rs("Card")
> bEMail = rs("EMail")
>
> With Response
> .Write "<TR>" & vbcr
> .Write "<TD width=160>" & strFirstName & " " & strSurname &
> "</TD>" & vbcr
> .Write "<TD align='center' width=100>"
> If bPhone Then .Write "<IMG SRC='images/yes.gif' ALT='' BORDER=0>"
> .Write "</TD>" & vbcr
> .Write "<TD align='center' width=100>"
> If bCard Then .Write "<IMG SRC='images/yes.gif' ALT='' BORDER=0>"
> .Write "</TD>" & vbcr
> .Write "<TD align='center' width=100>"
> If bEMail Then .Write "<IMG SRC='images/yes.gif' ALT='' BORDER=0>"
> .Write "</TD>" & vbcr
> .Write "<TD width=23><A HREF='http://?'>Edit</A></TD>" & vbcr
> .Write "<TD width=23><A HREF='http://?'>Delete</A></TD>" & vbcr
> .Write "</TR>" & vbcr
> End With
> rs.MoveNext
> Loop
>
> rs.Close
> Set rs = Nothing
>
> End Sub
>
>
> I want to know how to professionally handle the 'time-out' of the
> session.
> At the moment when the app. times out Session.Contents("MemberID")
> equals 0.
> Which means I get an error:
>
> "ADODB.Field (0x800A0BCD)
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record."
>
> I don't really want to handle the BOF/EOF error directly as this is just
> a symptom of a different problem (the time out).
>
> Would I have to force the user to log in again?
> Increase the time out?
> How do other people do this??
>
> I also don't see how appropriate it would be to increase the timeout to,
> say 2 hours. When the site generates large amounts of traffic then
> keeping 100s of sessions live for so long is going to eat too many
> resources.
>
> Do other people use cookies to store the memberID instead of a session
> variable?
> If so - what do they do about people who have cookies blocked?
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
- Next message: Evertjan.: "Re: Handle Session Timeout And Lost MemberID"
- Previous message: Edward Rothwell: "Handle Session Timeout And Lost MemberID"
- In reply to: Edward Rothwell: "Handle Session Timeout And Lost MemberID"
- Next in thread: Evertjan.: "Re: Handle Session Timeout And Lost MemberID"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|