E
Edward Rothwell
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:
<%
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?
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:
<%
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?